diff options
author | Father Chrysostomos <sprout@cpan.org> | 2014-02-08 13:10:59 -0800 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2014-02-08 17:34:25 -0800 |
commit | adf7680562287218c9f721ec3eb5028bc143e31b (patch) | |
tree | 5b042d911ce456bd06673557104cdb49b5690e68 /lib/diagnostics.pm | |
parent | 4a8eb7ce51a91409fad49ada0f4bee3416a3d4c1 (diff) | |
download | perl-adf7680562287218c9f721ec3eb5028bc143e31b.tar.gz |
diagnostics.pm: Eliminate $WHOAMI
This variable only held the package name. __PACKAGE__ is faster,
as it allows constant folding.
diagnostics.pm just happens to be older than __PACKAGE__, which was
introduced as recently as 1997 (68dc074516).
Diffstat (limited to 'lib/diagnostics.pm')
-rw-r--r-- | lib/diagnostics.pm | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/diagnostics.pm b/lib/diagnostics.pm index d6a5caf230..a85f282044 100644 --- a/lib/diagnostics.pm +++ b/lib/diagnostics.pm @@ -208,7 +208,6 @@ unshift @trypod, "./pod/perldiag.pod" if -e "pod/perldiag.pod"; (my $PODFILE) = ((grep { -e } @trypod), $trypod[$#trypod])[0]; $DEBUG ||= 0; -my $WHOAMI = ref bless []; # nobody's business, prolly not even mine local $| = 1; local $_; @@ -238,7 +237,7 @@ CONFIG: { if (caller) { INCPATH: { - for my $file ( (map { "$_/$WHOAMI.pm" } @INC), $0) { + for my $file ( (map { "$_/".__PACKAGE__.".pm" } @INC), $0) { warn "Checking $file\n" if $DEBUG; if (open(POD_DIAG, $file)) { while (<POD_DIAG>) { @@ -450,7 +449,7 @@ my %msg; $transfmt{$header}{len} = length( $header ); } - print STDERR "$WHOAMI: Duplicate entry: \"$header\"\n" + print STDERR __PACKAGE__.": Duplicate entry: \"$header\"\n" if $msg{$header}; $msg{$header} = ''; @@ -538,7 +537,7 @@ sub disable { sub warn_trap { my $warning = $_[0]; - if (caller eq $WHOAMI or !splainthis($warning)) { + if (caller eq __PACKAGE__ or !splainthis($warning)) { if ($WARNTRACE) { print STDERR Carp::longmess($warning); } else { @@ -563,7 +562,9 @@ sub death_trap { } splainthis($exception) unless $in_eval; - if (caller eq $WHOAMI) { print STDERR "INTERNAL EXCEPTION: $exception"; } + if (caller eq __PACKAGE__) { + print STDERR "INTERNAL EXCEPTION: $exception"; + } &$olddie if defined $olddie and $olddie and $olddie ne \&death_trap; return if $in_eval; |