Subject: | XS part of Cwd seems to confuse caller |
I am only reporting this because it may be an indication of some subtle
memory corruption. The attached test fails for me on Strawberry perl 5.12:
package Main::Caller;
my @stacktrace;
BEGIN {
*CORE::GLOBAL::require = sub {
if ($_[0] eq 'Win32.pm' and ! @stacktrace) {
my $i = 0;
while (my @f = caller($i++)) {
push @stacktrace, [ @f[0..3] ];
}
}
CORE::require($_[0]);
};
}
use warnings;
use strict;
use Test::More;
{
package Expected::Caller;
use Cwd;
sub import { chdir(getcwd()) }
}
Expected::Caller::import();
ok (
( !grep { $_->[3] =~ /Main::Caller/ } @stacktrace ),
'nothing ever called back into the topmost namespace'
);
done_testing;