Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: lexical variables and signal handlers

by Lachesis (Friar)
on May 27, 2003 at 14:52 UTC ( [id://261004]=note: print w/replies, xml ) Need Help??


in reply to lexical variables and signal handlers

If you want to trigger from the alarm, you'll want to use $SIG{ALRM} rather than INT. You don't have to put $var global it just needs to be in the same scope as the signal handler so you could have
alarm(1); while(1) { my $var = "wibble"; $SIG{ALRM} = sub { die "borked on $var"; }; } alarm(0);
That said I assume that you want to a bit more than just trigger an alarm so it might help if you could give it bit more context

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2024-04-25 06:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found