Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Try::Tiny catch block with $_ eq ''

by vsespb (Chaplain)
on May 16, 2013 at 21:29 UTC ( #1033911=note: print w/replies, xml ) Need Help??


in reply to Try::Tiny catch block with $_ eq ''

I don't know answer to your question, but you can try use perl 'sigtrap' module to get stacktrace, and possibly temporary replace try/catch/$_ with 'unless defined eval { }'/$@ , to debug your code.
UPD: For example
unless (defined eval { $self->_run($self, $row_id, $subject); 1 }) { $logger->error("run($row_id): $@\n") }; $self->_clear_subject;
this way you'll check if that is the problem with "my $_" or no.

Replies are listed 'Best First'.
Re^2: Try::Tiny catch block with $_ eq ''
by dd-b (Monk) on May 16, 2013 at 22:39 UTC

    I'm using Try::Tiny because they claim it's hard to really use eval correctly to do this, but I could switch back and hope I don't hit their problem cases, at least as a test. We shall see. I've been putting eleventy-dozen $logger->trace("point 17"); statements through the code it comes out of unexpectedly to narrow down where it is. Setting up the database for a test run and then analyzing the log is not as simple as I could hope it was (though far better than my test setup procedure two weeks ago :-) ).

      I think it's hard when there are nested evals. Otherwise it's pretty simple, if you read the docs carefully.

        That's not the main eval gotcha that Try::Tiny seeks to solve. Amongst the things mentioned in Try::Tiny's documentation are:

        • It is possible to throw an exception which is considered false in a boolean context, thus breaking if ($@). Try::Tiny isn't fooled by that.
        • If a DESTROY method calls eval then an object used within your eval could potentially clobber $@. Try::Tiny creates a copy of $@ that is safe, and passes it as a parameter to the catch block.

        These errors are fairly rare in practice, but extremely difficult to figure out when they do happen. People who have been burned by them in the past tend to appreciate Try::Tiny quite a lot.

        package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1033911]
help
Chatterbox?
[marto]: yeah, I think that as a group creatively they're done. I can understand how it'd be hard to stop the process, album/tour, album/tour, if that's pretty much all you've ever done :)
[marto]: Corion yes I saw them Pandemonium_Tour
[Corion]: marto: Yeah, and I doubt that they'll ever get back to something like Violator/Songs of Faith and Devotion - it would either alienate their "regular" crowd, or be "too much Violator" ;)
LanX needs to see Freddy Mercury'
[Corion]: marto: Yeah, I have that on DVD even, and I missed them last year because I was in London at the time ironically ;)
[marto]: put me in the mood to listen to this now :)
[Corion]: LanX: Well, grab a shovel :)
[Corion]: Kraftwerk also are still touring (well, only Ralf Hütter and Florian Schneider), but I'm too tight fisted to spend EUR 150+ for standing around two hours ;)
[Corion]: Oh. Queen have a new front man. Not really sure...
[marto]: Florian retired some years ago. I have been gifted a ticket to their show in Glasgow as my friends husband can no longer make it

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (9)
As of 2017-03-24 11:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (301 votes). Check out past polls.