Hey all,
So I'm using NET::Ftp to transfer files on demand from a remote server. However, despite all the checks for valid characters in filenames, I cant by the nature of the beast stop users giving my script filenames to retrieve that dont exist.
What I need to do is attempt to grab a file but trap if the server gives me a "file not found" error.
I thought about just checking if the file exists after the transfer has taken place - thus proving whether or not it was downloaded but that seems rather inelegant to me.
Anyone know how to check for errors with NET::Ftp? Perldoc doesn't seem to mention anything.
The code I'm using to grab the file is thus.
sub fetch_metar {
$ftp = Net::FTP->new($hostname);
$ftp->login("anonymous","metar\@speedfreak.com");
$ftp->get($path.$station.".TXT", $datapath.$station.".TXT");
$ftp->quit;
}
- Jed In reply to Trapping errors from NET::Ftp by Speedfreak
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |