<font face="courier new,monospace"><br></font><br><div class="gmail_quote">On Wed, Apr 4, 2012 at 10:51 PM, Marc Lehmann <span dir="ltr"><<a href="mailto:schmorp@schmorp.de">schmorp@schmorp.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Wed, Apr 04, 2012 at 10:44:31AM -0400, Fulko Hew <<a href="mailto:fulko.hew@gmail.com">fulko.hew@gmail.com</a>> wrote:<br>
> I've managed to narrow down the problem and create a simple test case shown<br>
> below.<br>
> It provides 4 different scenarios (some commented out); but let me explain<br>
> how I<br>
> got to this point in my application/module development...<br>
<br>
</div>Your mail is really confusingly formatted.<br>
<div class="im"><br>
> but now I'm no longer allowed to catch the __DIE__ (now that I need<br>
> to use run_cmd) unless the GLOB error/issue is resolved).<br>
<br>
</div>If you mean that you install a __DIE__ handler, then what you do inside<br>
is really your problem <br></blockquote><div><br>... snip ...<br> <br>I'm sorry if its confusing, I thought I made it as clear and as short as possible.<br><br>There are two (AnyEvent) issues that I am reporting/questioning; the 4 different<br>
tests (indicated by the comments at the bottom of the code), allow testing of<br>all the permutations, when the appropriate signal catcher installer is uncommented<br>and the appropriate error generator is uncommented.<br>
<br>The two issues are:<br><br>1/ Attempting to install a DIE catcher using $SIG{__DIE__}=<br>causes the Perl to generate the GLOB error I was originally questioning,<br>preventing the app from even starting [regardless of why I am trying to<br>
catch the DIE and what I will do with it].<br><br>--------- generate GLOB error ----------<br><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">use strict;</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">use warnings;</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">use Coro;</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">use AnyEvent;</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">use AnyEvent::Util;</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">use Carp;</span><br style="font-family:courier new,monospace"><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">sub clucker { print "clucker called\n"; Carp::cluck(@_); exit 0; }</span><br style="font-family:courier new,monospace">
<br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">sub obtainer {</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> my $ps_cv = run_cmd "", ">" => sub {};</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> $ps_cv->recv;</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"></span><span style="font-family:courier new,monospace">}</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"></span><br style="font-family:courier new,monospace">$<span style="font-family:courier new,monospace">SIG{__DIE__} = \&clucker;</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"></span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">my $obtainer = AnyEvent->timer(after => 1, cb => \&obtainer);</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">AnyEvent->condvar->wait;<br>
<br></span>--------- end of 'generate GLOB error' ----------<br><br><br style="font-family:arial,helvetica,sans-serif"><span style="font-family:arial,helvetica,sans-serif">2/ Using AnyEvent->signal() silently fails to catch __WARN__.</span><br>
</div></div><br>--------- fail to catch WARN ----------<br><br><span style="font-family:courier new,monospace">use strict;</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">use warnings;</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">use Coro;</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">use AnyEvent;</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">use AnyEvent::Util;</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">use Carp;</span><br style="font-family:courier new,monospace"><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">sub clucker { print "clucker called\n"; Carp::cluck(@_); exit 0; }</span><br style="font-family:courier new,monospace">
<br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">sub obtainer {</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> my $ps_cv = run_cmd "", ">" => sub {};</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> $ps_cv->recv;</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> print "bug!\n" if (undef == 5); # uncomment to cause a __WARN__</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"></span><span style="font-family:courier new,monospace">}</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"></span><br><span style="font-family:courier new,monospace">my $d = AnyEvent->signal(signal => "__WARN__", cb => \&clucker);</span><br style="font-family:courier new,monospace">
<br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">my $obtainer = AnyEvent->timer(after => 1, cb => \&obtainer);</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">AnyEvent->condvar->wait;</span><br>
<br>--------- end of 'fail to catch WARN' ----------<br><br><br>