Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Re: Strange SIGNAL HANDLER behavior...

by Clownburner (Monk)
on Oct 24, 2001 at 23:41 UTC ( [id://121245]=note: print w/replies, xml ) Need Help??


in reply to Re: Strange SIGNAL HANDLER behavior...
in thread Strange SIGNAL HANDLER behavior...

That makes perfect sense, and is kinda what I was thinking.. But: 1) why do the Camel, Llama, and Goat all show examples like this, then? Perl Cookbook, pg 587:
$SIG{INT} = \&got_int;
..and 2) Why doesn't the hard anonymous subroutine reference also execute the subroutine immediately? Doesn't this say set $SIG{QUIT} to the value returned by sub{ GotSignal('quit'} }; ??
local $SIG{QUIT} = sub { GotSignal('quit') };
I'm just trying to make sense of Perl's internal logic here.. Maybe that's my first mistake... ;-)
"Non sequitur. Your facts are un-coordinated." - Nomad

Replies are listed 'Best First'.
Re (3): Strange SIGNAL HANDLER behavior...
by VSarkiss (Monsignor) on Oct 24, 2001 at 23:59 UTC

    The difference is that you have parens following the sub name, which parses as a subroutine call. You can't create a reference to a sub invocation with particular arguments, you can only create a reference to a sub. If you need to set values in the sub, you'll need closures.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (7)
As of 2024-03-28 10:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found