Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re: Die inside Try::Tiny blocks

by chromatic (Archbishop)
on Apr 26, 2013 at 21:17 UTC ( #1030895=note: print w/replies, xml ) Need Help??

in reply to Die inside Try::Tiny blocks

What can I reasonably expect about a die command in the catch block, or the finally block?

As the documentation suggests, you are responsible for your own error handling in the finally block. That means you need to use eval or try in it (though I shudder at the thought of the latter).

The point of running "server" distributions is known-compatible packages conservatively chosen, right?

I think in truth it's that "Installing software is haaaaaaaaaaard." I wouldn't take RHEL's suggestions on what makes for good Perl.

Replies are listed 'Best First'.
Re^2: Die inside Try::Tiny blocks
by dd-b (Monk) on Apr 27, 2013 at 19:47 UTC

    Yes, I guess those statements about error handling do imply the behavior I'm seeing. They don't immediately make me think of that behavior, though. I'll try to figure out of I can make it clearer and try a doc patch if so.

    Since Try::Tiny says it exists to avoid the mistakes people make using eval for this kind of thing it does seem like using it again inside the the finally block as needed is what the authors had in mind...should be amusing.

    (I only had one place in the code I'm actually working on where I'd messed up use of try blocks, but it was good to run through and check all the ones I'd added to be sure.)

      You're probably doing something far more complicated than you ought to if your finally block can throw an exception. I wouldn't do anything more than logging an error or setting a flag to restart a computation.

        So finally blocks aren't in fact good ways to make sure cleanup gets performed? That's kind of advertised as their main purpose -- but DBIx, for example, reports most errors with exceptions (and I like that style in general).

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1030895]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (2)
As of 2018-05-26 01:22 GMT
Find Nodes?
    Voting Booth?