5
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);
1..1
Can't return outside a subroutine at /usr/local/share/perl/5.8.8/DateTime/TimeZone/Local.pm line 72.
# Looks like your test exited with 9 before it could output anything.
shell returned 9
我已经确认并肯定它是一个子程序内。它不似乎是任何与使用的模块,该代码也导致了同样的错误:
my @output = sort {
sub1();
} (1 .. 5);
sub sub1 {
eval "use ModuleDoesntExist";
return 1; # remove this and get a seg fault
}
看起来它是PERL比什么都重要的错误。有任何想法吗?更感兴趣的是为什么发生这种情况而不是解决方法 - 只有当模块不存在时才会发生。
在这里工作很好。 – cdhowie 2010-11-17 16:01:50
在Linux上运行,PERL版本5.8.8 - 你? :( – 2010-11-17 16:02:33
Debian Lenny,Perl 5.10.0。 – cdhowie 2010-11-17 16:04:17