HOME
TUTORIAL
∇
Applets
Comments
CSS
Document Tags
Embed
Fonts
Forms
Frames
Images
Lines & Paragraphs
Links
Lists
Logical Tags
Scripts
Sounds
Symbols
Tables
Weird Tags
FORUM
∇
HTML Help
Web Design
Programming Languages
Web Hosting
Domain Names
Marketing
Community
QUICK LIST
CSS
HTML Help Forum
FAQ
Search
Memberlist
Register
Profile
Log in to check your private messages
Log in
Register
- Not registered yet? Got something to say?
Join HTML Code Tutorial
!
Limit perl code execution time
HTML Help Forum
->
Perl
View previous topic
::
View next topic
Author
Message
zylstra
Site Admin
Joined: 10 May 2004
Posts: 138
Posted: Tue Jun 27, 2006 5:02 pm
Limit perl code execution time
I need to limit the execution time of a particular line of code because it sometimes crashes the script:
Code:
eval {$whois_info = `whois $domain`};
I would like the script to continue running even if the script stops that particular line of code.
How do I accomplish this?
zylstra
Site Admin
Joined: 10 May 2004
Posts: 138
Posted: Tue Jun 27, 2006 11:40 pm
I found the answer with
Code:
$SIG{ALRM} = \&timed_out;
eval {
alarm (10);
$whois_info = `whois $domain`;
alarm(0); # Cancel the pending alarm if whois responds.
};
if ($@ =~ /GOT TIRED OF WAITING/) {
print " Whois timed out: $@ ";
}
sub timed_out {
die "GOT TIRED OF WAITING";
}
Display posts from previous:
All Posts
1 Day
7 Days
2 Weeks
1 Month
3 Months
6 Months
1 Year
Oldest First
Newest First
HTML Help Forum
->
Perl
All times are GMT - 8 Hours
Page
1
of
1
Jump to:
Select a forum
Announcements
----------------
Announcements
HTML Help
----------------
Member Tutorials
General HTML
HTML Form
HTML Table
HTML Frame
CSS
DHTML
SSI
MySpace
HTML Tools
Web Design
----------------
Images & Graphics
Templates
Multimedia
Programming Languages
----------------
Javascript
PHP
Perl
ASP
Others
Web Hosting
----------------
Free Hosting
Shared Hosting
Dedicated, Managed, and Co-located Hosting
Hosting Business and Reseller Hosting
Domain Names
----------------
Registrars
Tools
For Sale, Wanted, & Appraisals
Expired Domains
Monetization
Legal Issues
Marketing
----------------
SEO
PPC
Affiliate Marketing
Other Internet Marketing
Community
----------------
Miscellaneous
Website Review
Introduce Yourself
Feedback
Praise
Errors
You
cannot
post new topics in this forum
You
cannot
reply to topics in this forum
You
cannot
edit your posts in this forum
You
cannot
delete your posts in this forum
You
cannot
vote in polls in this forum
Your Ad Here
HTML Help Archive
Powered by phpBB © 2001, 2005 phpBB Group
DARFUR
Get a
Stop the Genocide
poster at
SaveDarfur.org
.
Also see
Eyes on Darfur
.
HOSTING / DESIGN
$1.99 Domain Registration
Cheap Web Hosting
Website Templates
MAKE MONEY
Sell Domain Names
Sell Website Templates
Home
|
Tutorials
|
Forum
|
Quick List
|
Link Directory
|
About
Copyright ©1997-2002 Idocs and ©2002-2007 HTML Code Tutorial