#!/usr/bin/perl -w
BEGIN {
my
$t
= dirname( __FILE__ );
if
( -d
"$t/../blib"
) {
lib->
import
(
"$t/../blib/arch"
,
"$t/../blib/lib"
);
}
elsif
( -d
"$t/../lib"
) {
lib->
import
(
"$t/../lib"
);
}
}
my
$mod
=
'IPC::Semaphore::SmokeSignals'
;
my
$fifo
=
"/tmp/fifo."
.
getppid
();
warn
"# fifo=$fifo\n"
;
END {
unlink
$fifo
if
$fifo
; }
alarm
( 10 );
my
$pipe
;
{
local
$SIG
{__WARN__} =
sub
{ };
$pipe
= MeetUp( [
'a'
..
'b'
],
$fifo
, 0666 );
}
warn
"# Pulling\n"
;
{
my
$dragon
=
$pipe
->Puff();
my
$tokin
=
$dragon
->Sniff();
warn
"# Got: $tokin\n"
;
warn
"# Sleeping $ARGV[0]\n"
;
sleep
(
$ARGV
[0] );
warn
"# Releasing\n"
;
}
warn
"# Exiting\n"
;