Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
eval {
local $SIG{ALRM} = sub { die "alarm\n" };
alarm 5;
sleep 100;
};
alarm 0;
eval {
local $SIG{ALRM} = sub { die "alarm\n" };
alarm 5;
print "Remark: ";
chomp($remark = <STDIN>);
};
alarm 0;
use threads;
use threads::shared; # threads by default don't share
my $remark : shared; # so we share this variable
# spawn a new thread to wait for input
my $in = threads->new (sub {
# Respond to kill signals
$SIG{KILL} = sub { threads->exit(); };
# Wait for input
print "Remark: ";
chomp ($remark = <STDIN>);
});
# control continues here immediately, even while the thread is waiting
sleep 5;
# if we have no input
if (not defined $remark) {
# then we can kill off the thread.
$in->kill('KILL')->detach;
}
else {
# we did get some input, do whatever with it
print "we got $remark!";
}