reproducible GLOB problem, Was: 'how to convert shell captures into anyevent style?'

Marc Lehmann schmorp at schmorp.de
Thu Apr 5 04:51:20 CEST 2012


On Wed, Apr 04, 2012 at 10:44:31AM -0400, Fulko Hew <fulko.hew at gmail.com> wrote:
> I've managed to narrow down the problem and create a simple test case shown
> below.
> It provides 4 different scenarios (some commented out); but let me explain
> how I
> got to this point in my application/module development...

Your mail is really confusingly formatted.

> but now I'm no longer allowed to catch the __DIE__ (now that I need
> to use run_cmd) unless the GLOB error/issue is resolved).

If you mean that you install a __DIE__ handler, then what you do inside
is really your problem - __DIE__ will be called each time an exception
will be thrown, not when perl dies with an error (see perlvar for more
implications).

If you only want to die when perl is going to die itself, then you need
to walk up the callstack with caller and see if you are within an eval
context. And ignore anything else that should be ignored. How to detetc
this is up to you.

When in doubt, leave your hands off __DIE__, it's not for the faint of
heart, and not meant to catch errors. If you want to catch errors, use
eval {}.

This also has nothing to do with AnyEvent, __DIE__ likely doesn't work as
you expect it to work (but it works as documented).

-- 
                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_              http://www.deliantra.net
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      schmorp at schmorp.de
      -=====/_/_//_/\_,_/ /_/\_\



More information about the anyevent mailing list