CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
$SIG{ALRM}

 



lord_hairball
stranger

Mar 1, 2001, 2:56 PM

Post #1 of 2 (579 views)
$SIG{ALRM} Can't Post

$SIG{ALRM} parameter executes the function immediately, never enters the loop.

script is coded as follows:

#!/usr/contrib/bin/perl -w
#tailsyslog.cgi
$|=1;

$SIG{ALRM} = &timed_out;

alarm 120;

print "Content-type: text/plain\n\n";

open (IX,'tail -f /var/adm/syslog/syslog.log |');
while (<IX>)
{
chop $_;
print "$_\n";
}
close (IX);

###################functions#####################

sub timed_out
{
die "Operation has timed out";
}

environment: perl 4.0 HPUX 10.20.

any help would be greatly appreciated.



japhy
Enthusiast

Mar 1, 2001, 3:04 PM

Post #2 of 2 (578 views)
Re: $SIG{ALRM} [In reply to] Can't Post

Please tell me you're not REALLY using Perl 4.0. If you are (sigh), do $SIG{ALRM} = "timed_out"; instead. If you're using Perl 5, you can do $SIG{ALRM} = \&timed_out;

Jeff "japhy" Pinyan -- accomplished hacker, teacher, lecturer, and author

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives