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

Fulko Hew fulko.hew at gmail.com
Thu Apr 5 05:23:18 CEST 2012


On Wed, Apr 4, 2012 at 10:51 PM, Marc Lehmann <schmorp at schmorp.de> wrote:

> 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
>

... snip ...

I'm sorry if its confusing, I thought I made it as clear and as short as
possible.

There are two (AnyEvent) issues that I am reporting/questioning; the 4
different
tests (indicated by the comments at the bottom of the code), allow testing
of
all the permutations, when the appropriate signal catcher installer is
uncommented
and the appropriate error generator is uncommented.

The two issues are:

1/ Attempting to install a DIE catcher using $SIG{__DIE__}=
causes the Perl to generate the GLOB error I was originally questioning,
preventing the app from even starting [regardless of why I am trying to
catch the DIE and what I will do with it].

--------- generate GLOB error ----------

use strict;
use warnings;
use Coro;
use AnyEvent;
use AnyEvent::Util;
use Carp;

sub clucker { print "clucker called\n"; Carp::cluck(@_); exit 0; }

sub obtainer {
    my $ps_cv = run_cmd "", ">" => sub {};
    $ps_cv->recv;
}

$SIG{__DIE__} = \&clucker;

my $obtainer = AnyEvent->timer(after => 1, cb => \&obtainer);
AnyEvent->condvar->wait;

--------- end of 'generate GLOB error' ----------


2/ Using AnyEvent->signal() silently fails to catch __WARN__.

--------- fail to catch WARN ----------

use strict;
use warnings;
use Coro;
use AnyEvent;
use AnyEvent::Util;
use Carp;

sub clucker { print "clucker called\n"; Carp::cluck(@_); exit 0; }

sub obtainer {
    my $ps_cv = run_cmd "", ">" => sub {};
    $ps_cv->recv;
    print "bug!\n" if (undef == 5);         # uncomment to cause a __WARN__
}

my $d = AnyEvent->signal(signal => "__WARN__", cb => \&clucker);

my $obtainer = AnyEvent->timer(after => 1, cb => \&obtainer);
AnyEvent->condvar->wait;

--------- end of 'fail to catch WARN' ----------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.schmorp.de/pipermail/anyevent/attachments/20120404/a200384b/attachment.html>


More information about the anyevent mailing list