Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^2: Signal Handling

by anshumangoyal (Scribe)
on May 21, 2012 at 06:35 UTC ( #971567=note: print w/ replies, xml ) Need Help??


in reply to Re: Signal Handling
in thread Signal Handling

Is there any other work out. Actually I want to write a Interrupt Subroutine which should take Parameters. This way it's not going to work.


Comment on Re^2: Signal Handling
Re^3: Signal Handling
by Anonymous Monk on May 21, 2012 at 17:48 UTC

    I can't imagine how you would send a SIGINT with a parameter but you can do whatever you want in the subroutine you assign to SIGINT. Just remember that you want to return control to the system ASAP once you're in the handler. Maybe something like this would work for you...

    $SIG{INT} = sub { my $obj = Whatever->new(); process_interrupt($obj) };
Re^3: Signal Handling
by lidden (Deacon) on May 23, 2012 at 02:13 UTC
    Well, often what you want to do is something like:

    $SIG{INT} = sub { our $sigint_gotten = 1;}; # Later in the code if(our $sigint_gotten){ our $sigint_gotten = 0; deal_with_it($arg1, $arg2, ...); }

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (12)
As of 2014-12-19 13:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (83 votes), past polls