in reply to Re: XML::Twig and Eval
in thread XML::Twig and Eval

small correction,the XML is :
<address> <city/> </address>
and not <addr>

taking off my SIG{__DIE__} handler which was calling explicitly exit made it continue

Does Eval call the DIE handler? but what if I want to continue when the code is wrapped in eval and die in all other occasions? I'm probably missing something fundamental here

Replies are listed 'Best First'.
Re^3: XML::Twig and Eval
by Corion (Patriarch) on Mar 28, 2016 at 09:34 UTC

    The fundamental thing is to not have a $SIG{__DIE__} handler at all, or at least, to not call exit in there. Also see $^S in perlvar and the discussion of it there relating to %SIG.

    Basically, what you've done is bad design and the sooner you go away from a $SIG{__DIE__}, the sooner your headaches will go away.

Re^3: XML::Twig and Eval
by jellisii2 (Hermit) on Mar 29, 2016 at 14:10 UTC

    IIRC, in your example, there's no text on the element "city", so it will be undef.

    Also eval seems to indicate that if you're using SIG{__DIE__} within your code, you'll want a local handler inside the eval.