While implementing a new
Log::Dispatch output channel called
Log::Dispatch::Perl (which is on its way to CPAN, but also available from
http://www.liz.nl/CPAN/), I found that I cannot conveniently "lose" a number of levels of the message created by Carp::longmess, as seen if you do a Carp::confess.
The documentation says:
Packages claim that there won't be errors on calls to or from packages explicitly marked as safe by inclusion in @CARP_NOT, or (if that array is empty) @ISA.
Ok, so I added:
our @CARP_NOT = ('Log::Dispatch::Output','Log::Dispatch');
to my Log::Dispatch::Perl code. But a Carp::confess still lists levels with these modules:
use Log::Dispatch::Perl;
my $dispatcher = Log::Dispatch->new;
my $channel = Log::Dispatch::Perl->new( qw(name default min_level debu
+g) );
$dispatcher->add( $channel );
$dispatcher->alert( 'This is an alert' );
__END__
This is an alert
Log::Dispatch::Output::log('undef','level','alert','name','def
+ault','message','This is an alert') called at /usr/local/lib/perl5/si
+te_perl/5.8.3/Log/Dispatch.pm line 95
Log::Dispatch::_log_to('Log::Dispatch=HASH(0xfc578)','level','
+alert','name','default','message','This is an alert') called at /usr/
+local/lib/perl5/site_perl/5.8.3/Log/Dispatch.pm line 74
Log::Dispatch::log('Log::Dispatch=HASH(0xfc578)','level','aler
+t','message','This is an alert') called at /usr/local/lib/perl5/site_
+perl/5.8.3/Log/Dispatch.pm line 22
Log::Dispatch::__ANON__('Log::Dispatch=HASH(0xfc578)','This is
+ an alert') called at line 7
What am I missing?
Liz
Update:
Thanks ysth for the feedback. In the end, it has come to removing the first 4 lines from Carp::longmess. The actual regexp to remove the first 4 lines will become s#^(?:[^\n]*\n){4}##s. New version of Log::Dispatch::Perl is on its way to CPAN.