The foswiki svn repository will become read-only on Friday 8/8. Developers should register for a http://github.com/ account for commit access to foswiki.

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

Priority: CurrentState: AppliesTo: Component: WaitingFor:
Urgent Closed Engine Configure  
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 Foswikirev:7801
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 CopyrightStatement. Creative Commons License