Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
While implementing a new Log::Dispatch output channel called Log::Dispatch::Perl (which is on its way to CPAN, but also available from, 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/ 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/ 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/ line 22 Log::Dispatch::__ANON__('Log::Dispatch=HASH(0xfc578)','This is + an alert') called at line 7

What am I missing?


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.

In reply to How to lose Carp levels with @CARP_NOT? by liz

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others rifling through the Monastery: (11)
    As of 2018-05-24 14:29 GMT
    Find Nodes?
      Voting Booth?