Uh oh... Unix user on a Mac... watch out!
I often upload to my webpage from my Mac. I used to do the ftp manually, and 'mput ' worked fine.
I wanted to automate the process so I wrote a script (ftpangela.pl) in perl (v5.8.1-RC3 built for darwin-thread-multi-2level
(with 1 registered patch...)) under OS X (10.3.9). It works fine for a while and then it hangs up in the middle of the transfer. Here is the dialog:
...
Net::FTP=GLOB(0x80fedc)>>> ALLO 45073
Net::FTP=GLOB(0x80fedc)<<< 202 No storage allocation necessary.
Net::FTP=GLOB(0x80fedc)>>> PORT 192,168,1,100,193,20
Net::FTP=GLOB(0x80fedc)<<< 200 PORT command successful
Net::FTP=GLOB(0x80fedc)>>> STOR B5.jpg
Net::FTP=GLOB(0x80fedc)<<< 150 Opening BINARY mode data connection for B5.jpg
Net::FTP=GLOB(0x80fedc)<<< 226 Transfer complete.
Net::FTP=GLOB(0x80fedc)>>> ALLO 4756
Net::FTP=GLOB(0x80fedc)<<< 202 No storage allocation necessary.
Net::FTP=GLOB(0x80fedc)>>> PORT 192,168,1,100,193,21
Net::FTP=GLOB(0x80fedc)<<< 200 PORT command successful
Net::FTP=GLOB(0x80fedc)>>> STOR B5t.jpg
Net::FTP=GLOB(0x80fedc): Timeout at ftpangela.pl line 41
Warning: something's wrong at ftpangela.pl line 41.
Net::FTP=GLOB(0x80fedc)>>> ALLO 40529
Net::FTP=GLOB(0x80fedc): Timeout at ftpangela.pl line 41
Net::FTP=GLOB(0x80fedc)>>> PORT 192,168,1,100,193,22
Net::FTP=GLOB(0x80fedc)<<< 421 No Transfer Timeout (300 seconds): closing control connection.
No Transfer Timeout (300 seconds): closing control connection.
Net::FTP=GLOB(0x80fedc)>>> ALLO 4496
Net::FTP: Unexpected EOF on command channel at ftpangela.pl line 41
Connection closed at ftpangela.pl line 41.
Is this a ftp problem? Perl problem? OS X problem? I'm transferring about 400 files; it dies randomly in the middle.
Here is my crude perl script (note, the line #s reported above no longer match the script below):
#! /usr/bin/perl -w
# this version intermittently stops with a timeout in the ftp put.
# see "perlftpfault.txt" for the error message.
# running the same commands at the command prompt instead of within
# perl runs fine. What is the issue? Too many files?
# the put doesn't fail with a warning; it just times out so Perl
# reports the warning.
use Net::FTP;
$ftp = Net::FTP->new('ftp.xxx.com', Debug => 1);
$ftp->login('xxx','xxx');
$ftp-> binary();
chdir("/Users/webpage/html");
foreach my $file (glob(''))
{
$ftp->put($file) or warn $ftp->message;
sleep(2);
}
$ftp->cwd("images");
chdir("images");
foreach my $file (glob(''))
{
$ftp->put($file) or warn $ftp->message;
sleep(2);
}
$ftp->cwd("slices");
chdir("slices");
foreach my $file (glob(''))
{
$ftp->put($file) or warn $ftp->message;
sleep(2);
}
$ftp->close();
$ftp->quit;
Any suggestions will be appreciated. The two second delays didn't help.
Page 1 of 1
perl ftp
#3
Posted 18 October 2006 - 11:07 PM
Why not try transmit, it easy to use and you can edit most scripts (html and php - not sure about perl scripts) by simply clicking on the script.
You can download a demo and try it out Transmit 3 Info
You can download a demo and try it out Transmit 3 Info
Page 1 of 1



Sign In
Register
Help

MultiQuote