Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: improve FTP script

by Illuminatus (Curate)
on Jun 14, 2012 at 18:01 UTC ( #976269=note: print w/ replies, xml ) Need Help??


in reply to improve FTP script

Well, one thing that comes to mind is that you 'die' in a lot of places, but only unlink the lockfile on success. If you run into a transient problem and you want the script to continue running after it clears, you should probably replace die with a function that removes the lockfile then dies

fnord


Comment on Re: improve FTP script
Re^2: improve FTP script
by asw (Initiate) on Jun 14, 2012 at 20:55 UTC

    thanks for the reply. yeah, that is true re: "die". I was looking it over again, and ran into a possible problem:

    if (scalar(@tmp_file_list) == 0) { die("the directory is empty!"); } else { foreach (@tmp_file_list) { if ($_ eq $lock_file) { die("Transfer_helper is busy."); } } }

    -- if there is are no files in the dir, the script should exit (and not write the lock file.

    I like the idea of creating a sub for managing the lock file. thanks

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (7)
As of 2015-07-04 13:10 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