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

Re: Signal Handling and alarm()

by mugwumpjism (Hermit)
on Jun 16, 2005 at 21:53 UTC ( [id://467463]=note: print w/replies, xml ) Need Help??


in reply to Signal Handling and alarm()

The general solution to this is to use POE, or in particular POE::Component::Client::UserAgent.

That might sound like a formidable thing to want to do, but I've had success in the past doing this without completely re-engineering the program - just turning each turn of the "event loop" you'll have written in your program into its own little POE session.

$h=$ENV{HOME};my@q=split/\n\n/,`cat $h/.quotes`;$s="$h/." ."signature";$t=`cat $s`;print$t,"\n",$q[rand($#q)],"\n";

Replies are listed 'Best First'.
Re^2: Signal Handling and alarm()
by gnork (Scribe) on Jun 17, 2005 at 10:46 UTC
    Thanks for the hint, I will try that ... since the servers are running in a production environment I will first take the quick route and plug from SIG{ALRM} to SIG{USR1} and send a kill -s USR1 $pid from the outside to initiate touching the files. Then there is no collision between the two timers.

    Another solution has been posted above. I will see which works better.

    I already spotted the places to turn into POE sessions, but the transition will take a while and has to be tested before going into production.

    Rgds,
    gnork

    cat /dev/world | perl -e "(/(^.*? \?) 42\!/) && (print $1))"
    errors->(c)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2024-04-25 20:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found