While this may be bending over backwards, this avoids causing problems
for the Perl compiler suite and also for various CPAN modules that use
A, B and C packages for testing.
use strict;
use warnings;
-our $VERSION = '1.20';
+our $VERSION = '1.21';
our $MaxEvalLen = 0;
our $Verbose = 0;
local $@;
my $where = eval {
my $func = $cgc or return '';
- my $gv = B::svref_2object($func)->GV;
+ my $gv =
+ *{
+ ( $::{"B::"} || return '') # B stash
+ ->{svref_2object} || return '' # entry in stash
+ }{CODE} # coderef in entry
+ ->($func)->GV;
my $package = $gv->STASH->NAME;
my $subname = $gv->NAME;
return unless defined $package && defined $subname;
use Carp qw(carp cluck croak confess);
BEGIN {
- plan tests => 57;
+ plan tests => 58;
# This test must be run at BEGIN time, because code later in this file
# sets CORE::GLOBAL::caller
'Carp can handle UTF8-flagged strings after a syntax error',
);
+fresh_perl_is(
+ q<
+ use Carp;
+ $SIG{__WARN__} = sub{};
+ carp ("A duck, but which duck?");
+ print "ok" unless exists $::{"B::"};
+ >,
+ 'ok',
+ {},
+ 'Carp does not autovivify *B::'
+);
+
# New tests go here
# line 1 "A"