in reply to $SIG{'ALRM'} on FreeBSD
Did you copy and paste that code, or attempt to retype it?
$ perl temp.pl String found where operator expected at temp.pl line 13, near "d 'Time +out on read'" (Do you need to predeclare d?) syntax error at temp.pl line 13, near "d 'Timeout on read'" Missing right curly or square bracket at temp.pl line 16, at end of li +ne syntax error at temp.pl line 16, at EOF Execution of temp.pl aborted due to compilation errors.
update: Ah, now (with your sub d) I get 100% CPU utilization, for much longer than a second, which I guess is probably similar to what you're getting, and which is presumably not what you want. So yeah, it appears the problem is not just something weird with your local setup, which is what I was trying to confirm. I threw in an extra warn and confirmed that $paddr is always undef, but I imagine what you're trying to do is limit execution time when there's no connection. Hmmm... select undef,undef,undef,$delay can measure fractional parts of a second, but I don't know how small its resolution goes. That would also stop you from consuming 100% CPU, though: just loop through $n tries with $totaltimelimit/$n delay each time. Would that work?
$ perl -v This is perl, v5.8.7 built for i386-freebsd-64int (with 2 registered patches, see perl -V for more detail) Copyright 1987-2005, Larry Wall Perl may be copied only under the terms of either the Artistic License + or the GNU General Public License, which may be found in the Perl 5 source ki +t. Complete documentation for Perl, including FAQ lists, should be found +on this system using `man perl' or `perldoc perl'. If you have access to + the Internet, point your browser at http://www.perl.org/, the Perl Home Pa +ge.
I wanted to help you out by testing your code on another FreeBSD
system, but I think there's more wrong than $SIG{ALRM} only.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: $SIG{'ALRM'} on FreeBSD
by b888 (Beadle) on Feb 24, 2006 at 13:38 UTC | |
by jonadab (Parson) on Feb 24, 2006 at 15:48 UTC |