|Think about Loose Coupling|
Yet more Try::Tiny problelmsby dd-b (Monk)
|on May 18, 2013 at 21:39 UTC||Need Help??|
dd-b has asked for the
wisdom of the Perl Monks concerning the following question:
This may be an interaction with Log::Log4perl
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:
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.