Skip Menu |

This queue is for tickets about the Sub-Recursive CPAN distribution.

Report information
The Basics
Id: 103191
Status: resolved
Priority: 0/
Queue: Sub-Recursive

People
Owner: Nobody in particular
Requestors: TONYC [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 0.05



Subject: defined %foo and defined @foo an error
Starting from perl 5.22 defined is no longer permitted on aggregates, ie. hashes and arrays. This has been warning as deprecated since at least 5.12, since it's behaviour is non-obvious. For an array or hash it doesn't check whether it has any elements, but whether some internal data structures have been initialized, for example: # perl 5.14.2 $ perl -M-warnings -le 'for (1 .. 2) { my %x; print 0+defined %x; print scalar keys %x; $x{abc} = 1 }' 0 0 1 0 The attached patch fixes the problem in Sub-Recursive. Tony
Subject: sub-recursive-defined.diff
diff -ru Sub-Recursive-0.03-EetaZk/t/02mutually.t Sub-Recursive-0.03-cEDMJN/t/02mutually.t --- Sub-Recursive-0.03-EetaZk/t/02mutually.t 2005-03-12 01:43:02.000000000 +1100 +++ Sub-Recursive-0.03-cEDMJN/t/02mutually.t 2015-03-30 15:47:52.000000000 +1100 @@ -7,7 +7,7 @@ BEGIN { use_ok('Sub::Recursive', qw/ mutually_recursive %REC /) } -ok(defined %REC, '%REC defined'); +ok(%REC, '%REC defined'); ok(defined &mutually_recursive, '&mutually_recursive defined'); my ($odd, $even) = mutually_recursive( Only in Sub-Recursive-0.03-cEDMJN/t: 02mutually.t~ diff -ru Sub-Recursive-0.03-EetaZk/t/90other.t Sub-Recursive-0.03-cEDMJN/t/90other.t --- Sub-Recursive-0.03-EetaZk/t/90other.t 2005-03-12 01:43:02.000000000 +1100 +++ Sub-Recursive-0.03-cEDMJN/t/90other.t 2015-03-30 15:49:04.000000000 +1100 @@ -10,7 +10,7 @@ ok(defined $REC, '$REC defined'); ok(defined &recursive, '&recursive defined'); -ok(defined %REC, '%REC defined'); +ok(%REC, '%REC defined'); ok(defined &mutually_recursive, '&mutually_recursive defined'); Only in Sub-Recursive-0.03-cEDMJN/t: 90other.t~
On 2015-03-30 00:52:03, TONYC wrote: Show quoted text
> Starting from perl 5.22 defined is no longer permitted on aggregates, > ie. hashes and arrays. > > This has been warning as deprecated since at least 5.12, since it's > behaviour is non-obvious. > > For an array or hash it doesn't check whether it has any elements, but > whether some > internal data structures have been initialized, for example: > > # perl 5.14.2 > $ perl -M-warnings -le 'for (1 .. 2) { my %x; print 0+defined %x; > print scalar keys %x; $x{abc} = 1 }' > 0 > 0 > 1 > 0 > > The attached patch fixes the problem in Sub-Recursive. > > Tony
It seems that this is issue is fixed in 0.04 and 0.05 and may be set to resolved.