Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

heusserm (4461)

heusserm
  (email not shown publicly)
http://www.xndev.com/
AOL IM: MatthewHeusser (Add Buddy, Send Message)

Matt Heusser is JAPH and an XP-Er [xprogramming.com]. (The Methodology, not the Operating System.) Right now, he's doing a lot of Test Driven Development in Perl.

Journal of heusserm (4461)

Monday December 22, 2003
01:45 PM

Net::Ftp.pm

[ #16463 ]

So, I've got some code that uses Net::Ftp.pm.

Now and again, I have to transfer really really big files. The whole system is automated, but it hangs and dies on a call to $ftp->put($filename).

So, the app dies, the sysadmin re-starts it, and it starts over again, transmitting the same file, hangs and dies. Never gets to the rest of the files, some of whom go to FTP sites that actually, you know, work.

I'm thinking of refactoring the code so that it just reports error instead of die-ing. Then it can process the ones that might work, and then come back and try again with the big file that only works rarely.

To do so, I'm planning on wrapping an eval block around the offensive code, and checking $@ to see if the call 'dies.'

Does this sound like a good approach?

regards,

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Net::FTP (Score:2, Informative)

    To do so, I'm planning on wrapping an eval block around the offensive code, and checking $@ to see if the call 'dies.'

    Does this sound like a good approach?

    There's no rule that says you have to stop the program if one file transfer fails, so yeah, that's how you can do it. Remember to include $ftp->message in the error message. Does a command line FTP of the same file to the same site work?