use DateTime::TimeZone::Local;
use Test::More tests => 1;
my @input = (1 .. 10 );
my (@output) = sort {
DateTime::TimeZone::Local->TimeZone();
$a cmp $b
} @input;
is_deeply(\@output, \@input);
Conclusion:
1..1
Can't return outside a subroutine at /usr/local/share/perl/5.8.8/DateTime/TimeZone/Local.pm line 72.
shell returned 9
I checked, and it is definitely inside the subroutine. This does not seem to be related to the module used, this code also causes the same error:
my @output = sort {
sub1();
} (1 .. 5);
sub sub1 {
eval "use ModuleDoesntExist";
return 1;
}
This seems to be a bug in PERL more than anything. Any ideas? More interested in why this happens than in a workaround - this only happens if the module does not exist.
source
share