Item9159: Perl 5.12 deprecates defined for hash and arrays. Configure fails on windows

pencil
Priority: Urgent
Current State: Closed
Released In: 1.0.10
Target Release: patch
Applies To: Engine
Component: Configure
Branches:
Reported By: GeorgeClark
Waiting For:
Last Change By: KennethLavrsen
See Support.Question539. Strawberry perl 5.12 will no longer run bin/configure. Fails with following error

Failed to load the perl module Foswiki::Configure::Load. The module was found at c:/www/foswiki/lib/Foswiki/Configure/Load.pm
...
defined(%hash) is deprecated at c:/www/foswiki/lib/Foswiki/Configure/Load.pm line 152.

See perldoc - http://perldoc.perl.org/functions/defined.html

Use of defined on aggregates (hashes and arrays) is deprecated. It used to report whether memory for that aggregate has ever been allocated. This behavior may disappear in future versions of Perl. You should instead use a simple test for size:
  1. if (@an_array) { print "has array elements\n" }
  2. if (%a_hash) { print "has hash members\n" }

The following instances were found in a quick search:

./lib/Foswiki/Configure/Load.pm:    if ( defined %TWiki::cfg ) {
./lib/CPAN/lib/Locale/Maketext/Lexicon.pm:            if (defined %{"$export\::Lexicon"}) {
./lib/CPAN/lib/Locale/Maketext/Lexicon/Tie.pm:        eval "use $mod; 1" or die $@ unless defined %{"$mod\::"};

GeorgeClark - 14 Jun 2010

The Locale::Maketext::Lexicon ones are fixed in more recent version of these modules, so maybe we should simply update out version?

As for my comment on trunk... IIRC, I alias *TWiki::cfg = \%Foswiki::cfg a few lines above it, therefore this code is most certainly useless and potentially harmful, but I haven't had time to test it.

-- OlivierRaginel - 18 Jun 2010
 

ItemTemplate edit

Summary Perl 5.12 deprecates defined for hash and arrays. Configure fails on windows
ReportedBy GeorgeClark
Codebase 1.0.9
SVN Range
AppliesTo Engine
Component Configure
Priority Urgent
CurrentState Closed
WaitingFor
Checkins distro:e5f3de3e212b
TargetRelease patch
ReleasedIn 1.0.10
Topic revision: r5 - 08 Sep 2010, KennethLavrsen
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy