Subject: | defined %foo and defined @foo an error |
Starting from perl 5.22 defined is no longer permitted on aggragates, 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.
Tony
Subject: | no-defined-aggregate.patch |
diff -ru PDF-Burst-1.20-MRnPWh/lib/PDF/Burst.pm PDF-Burst-1.20-v1YQc8/lib/PDF/Burst.pm
--- PDF-Burst-1.20-MRnPWh/lib/PDF/Burst.pm 2011-10-02 09:45:48.000000000 +1100
+++ PDF-Burst-1.20-v1YQc8/lib/PDF/Burst.pm 2015-03-30 14:50:39.000000000 +1100
@@ -308,7 +308,7 @@
}
close FILE;
- defined %dat or warn("had nothing in '$doc_dat'?") and return;
+ %dat or warn("had nothing in '$doc_dat'?") and return;
return \%dat;
}