This may be an interaction with Log::Log4perl

$logger->trace("Point 9.85"); # create an API notice try {$self->publish_notice( $subject->upload->mapping->map_id, $csv_row->row_id, q(InvalidValue), $csv_row->grain, q(Domain::Products), $item_name // '' );} catch { $logger->trace("point 9.9"); $logger->logdie("Notice failed: ",Dumper($_)); $logger->trace("point 9.92"); die ("Notice failed ".Dumper($_)); }; # stuff something into the log $logger->trace("Point 9.9");

is producing the following log output:

20130518 16:19:53.264 TRACE 29309 PreparePayment.pm(175) _run: Point 9.85 
20130518 16:19:53.268 TRACE 29309 PreparePayment.pm(184) __ANON__: point 9.9 
20130518 16:19:53.269 FATAL 29309 PreparePayment.pm(185) __ANON__: Notice failed: $VAR1 = 'sale-item'; 
20130518 16:19:53.272 ERROR 29309 PreparePayment.pm(78) __ANON__: run(OT::DB::Result::Csv=HASH(0xa47dd00)): $VAR1 = '';

That last log line, from PreparePayment line 78, comes from the $logger call in this:

try { $self->_run($row_id, $subject) } catch { $logger->error("run($row_id): ".Dumper($_)) };

So, you see what's happening there? $self->publish_notice() is failing (in ways that are also impossible) and putting us into the catch block. We log that we're at point 9.9, and we log the "Notice failed" message. That same message should be thrown as an exception by logdie(), and we don't get to point 9.92 so it looks like the die probably happened. However, up around line 78 where we catch that exception, we get an empty string.

It may be relevant that $self->publish_notice is from a Moose::Role, and that $logger calls in there (it fetches its own logger, and checks it's non-null) don't result in log output.

Anybody have any thoughts? I've gone through our previous discussions of Try::Tiny and I don't see any of the problematic things happening here.


In reply to Yet more Try::Tiny problelms by dd-b

Title:
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, details, 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, summary, 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.