Subject: | Improve documentation on %Carp::Internal |
(I cannot select VERSION 1.42 as found in OpenSUSE Leap 15.1 perl-base-5.26.1-lp151.9.3.1.x86_64)
Fighting to suppress some entries in confess()'s call stack, I noticed that the documentation is kind of poor:
---
%Carp::Internal
This says what packages are internal to Perl. "Carp" will never report
an error as being from a line in a package that is internal to Perl.
For example:
$Carp::Internal{ (__PACKAGE__) }++;
# time passes...
sub foo { ... or confess("whatever") };
would give a full stack backtrace starting from the first caller
outside of __PACKAGE__. (Unless that package was also internal to
Perl.)
---
The specification is per example only, and it seems the implementation is using "$Internal{$call_pack}" as condition instead of "exists($Internal{$call_pack})".
So "$Carp::Internal{(__PACKAGE__)} = undef" does not work, while "$Carp::Internal{(__PACKAGE__)} = 1" works.