Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^5: die through several evals

by BrowserUk (Pope)
on Apr 24, 2013 at 18:05 UTC ( #1030470=note: print w/ replies, xml ) Need Help??


in reply to Re^4: die through several evals
in thread die through several evals

That is exactly what is meant to happen.

You wrap code in an eval in order to trap any error that might occur. If you then chose to not check for an error having occurred, then the code will continue as if no error had occurred.

If you don't want the error to be ignored, you should either check for an error and rethrow if that is apppropriate; or don't use the eval in the first place.

(And your 'visible'/'invisible' strings make no sense because: a) they are both visible; b) they should be!)

I think that you'd better describe the overall goal you are trying to achieve, rather than looking to find a way to undo the very effect that the eval statement is designed to provide.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.


Comment on Re^5: die through several evals
Re^6: die through several evals
by nyaapa (Novice) on Apr 30, 2013 at 07:34 UTC
    i need function like with_timeout(&;$), it executes first argument with timeout. I can't use fork and storable/json, because of db handlers or something.
    also, i cant control passed sub for eval propagate.

      Wow. Does your ISP charge you by the word :)

      Let's see if I can expand on that a little.

      You want to write a subroutine, that takes an arbitrary code reference or block -- possible supplied by a third party -- and a number of seconds, as arguments. And you want to run that code; and time it out if it runs to long.

      And the issue you are trying to address is that the code might throw an error (die) within an eval block within the coderef you are given, and not re-throw the error?

      Does that sum up the problem?


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.
        yep :)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1030470]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2014-11-01 04:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (227 votes), past polls