diff options
author | David Golden <dagolden@cpan.org> | 2009-11-06 23:38:27 -0500 |
---|---|---|
committer | David Golden <dagolden@cpan.org> | 2009-11-06 23:56:15 -0500 |
commit | 248ae9a50ac9959cef3e64dbc204644da4b8761a (patch) | |
tree | 83b3a9888b79d131fe77deae497c2eb1abb3df31 /lib/Carp.t | |
parent | 4d719414e6f0d6b9d62a6f374be0da25e41f43ea (diff) | |
download | perl-248ae9a50ac9959cef3e64dbc204644da4b8761a.tar.gz |
refine Carp caller() fix and add tests
Diffstat (limited to 'lib/Carp.t')
-rw-r--r-- | lib/Carp.t | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/Carp.t b/lib/Carp.t index af07ed661c..63b43b21c5 100644 --- a/lib/Carp.t +++ b/lib/Carp.t @@ -8,7 +8,7 @@ my $Is_VMS = $^O eq 'VMS'; use Carp qw(carp cluck croak confess); -plan tests => 37; +plan tests => 39; ok 1; @@ -266,6 +266,18 @@ cluck "Bang!" cluck_undef (0, "undef", 2, undef, 4); +# check that Carp respects CORE::GLOBAL::caller override after Carp +# has been compiled +{ + my $accum = ''; + local *CORE::GLOBAL::caller = sub { local *__ANON__="fakecaller"; my @c=CORE::caller(@_); $c[0] ||= 'undef'; $accum .= "@c[0..3]\n"; return CORE::caller(($_[0]||0)+1) }; + eval "scalar caller()"; + like( $accum, qr/main::fakecaller/, "test CORE::GLOBAL::caller override in eval"); + $accum = ''; + A::long(); + like( $accum, qr/main::fakecaller/, "test CORE::GLOBAL::caller override in Carp"); +} + # line 1 "A" package A; sub short { |