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

Priority: Urgent
Current State: Closed
Released In: 1.0.10
Target Release: patch
Applies To: Engine
Component: Configure
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/
defined(%hash) is deprecated at c:/www/foswiki/lib/Foswiki/Configure/ line 152.

See perldoc -

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/    if ( defined %TWiki::cfg ) {
./lib/CPAN/lib/Locale/Maketext/            if (defined %{"$export\::Lexicon"}) {
./lib/CPAN/lib/Locale/Maketext/Lexicon/        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
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