And so you can see it in action, here's a test/demonstration script for this module.
#!/usr/bin/perl -w # # Test of Alarm::Concurrent - Written by Cory Johns (c) 2001 # ++$|; BEGIN { # This will be saved and activated when # Alarm::Concurrent is imported. alarm(1); $SIG{ALRM} = sub { print "Legacy alarm." }; } use Alarm::Concurrent qw( :OVERLOAD :ALL ); setalarm(6, sub { print "BONG!!!" }); alarm(2); sethandler(sub { print "bing" }); MyPack::doalarm(); # Alarms set for the same time go # off in the order you set them. setalarm(4, sub { print "!" }); package MyPack; sub doalarm { # Alarm is overridden in _all_ namespaces. alarm(4); # $SIG{ALRM} has been taken over. # It now calls sethandler(). $SIG{ALRM} = sub { print "bong" }; } #*******************************************# package main; for(1..6) { print "Second $_... "; sleep 1; print "\n"; }
bbfu
Seasons don't fear The Reaper.
Nor do the wind, the sun, and the rain.
We can be like they are.
In reply to (bbfu) Test/Demonstration script for Alarm::Concurrent
by bbfu
in thread Alarm::Concurrent
by bbfu
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |