Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Net::FTP problems

by rob_au (Abbot)
on Dec 29, 2003 at 12:21 UTC ( #317415=note: print w/ replies, xml ) Need Help??


in reply to Net::FTP problems

Is there a way to trap the Net::FTP error message before find myself in the operating system so that I can act on it?

For this you can use the eval function to trap fatal errors from Net::FTP functions.

Is there a way to make my own timeout function?

For this you will want to have a read through the alarm function and the perlipc documentation.

For example:

my $retrieval = undef; my $timeout = 120; eval { local $SIG{'ALRM'} = sub { die 'timeout' }; alarm $timeout; $retrieval = $ftp->get($remote_file, $local_file); alarm 0; }; if ($@) { if ($@ =~ /timeout/) { } }

 

perl -le "print+unpack'N',pack'B32','00000000000000000000001010100001'"


Comment on Re: Net::FTP problems
Download Code
Re: Re: Net::FTP problems
by panaman (Acolyte) on Dec 30, 2003 at 11:19 UTC
    Thank for your good answer, it helps. the "eval" seems to have stopped the being tossed into the OS. I am going to move this app over to a linux box since I have discovered that windows does not do signal proccessing acording to the perldocs. thanks

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://317415]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (3)
As of 2015-07-05 03:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (60 votes), past polls