Oh, sorry. Sure, the code is below. I had to change the actual details (of course), but the format is the same.
I'm using single quotes already, though. So it shouldn't read the "@" as a special character, right?
my $un = 'username@domain.com;
my $pw = 'password';
print "- FTPing report... ";
my $ftp;
my $status = 1;
my ($connectattempts, $putattempts, $cwdattempts, $loginattempts) =
+(0,0,0,0);
STARTFTP:
$ftp = Net::FTP->new("host.com", Debug => 0, Passive => 0) or $statu
+s = 0;
if (!$status) {
if ($connectattempts < 3) {
$connectattempts++;
print "Session failed, retrying in 60 seconds\n";
$status = 1;
sleep 60;
goto STARTFTP;
}
else { goto FAILED; }
}
$status = $ftp->login($un,$pw);
if (!$status) {
if ($loginattempts < 3) {
$loginattempts++;
print "Login failed, retrying in 60 seconds\n";
$status = 1;
sleep 60;
goto STARTFTP;
}
else { goto FAILED; }
}
$ftp->binary();
$status = $ftp->put($outputfile,$outputfile);
if (!$status) {
if ($putattempts < 3) {
$putattempts++;
print "PUT command failed, retrying in 60 seconds\n";
$status = 1;
sleep 60;
goto STARTFTP;
}
else { goto FAILED; }
}
$ftp->quit;
print "$file successfully uploaded.\n";
unlink $file;
return 1;
FAILED:
print "$file was not transferred to host.com! Please upload manually
+!\n\n";
return 0;
}
Thanks for looking at this. | [reply] [d/l] |
A peek at the Net::FTP sourcecode shows that $user is almost everywhere getting @host.com appended before being used. Which begs the question, why do you create a new ftp object to host.com, then try to connect to domain.com through the username?
I don't know if credentials such as user@domain.com@host.com are allowed, but it looks fishy and overcomplicated. I can't immediately see where the error message is coming from, but maybe a troll with the debugger will set you straight?
Have you tried setting the hostname only in new?
-QM
--
Quantum Mechanics: The dreams stuff is made of
| [reply] [d/l] [select] |
I wondered the same thing originally, but thought it was maybe my naivety. I'll speak to admin about it now though, since it looks like the problem isn't on my end (as per my reply to tmharish).
Thanks for the assist!
| [reply] |
| [reply] [d/l] |
Just double checked that. That's a typo when copying the code over and changing the details, sorry. The quote is definitely closed in the script.
| [reply] |