Let's see, I've been using this in production for quite a while, and I think
it's been doing OK.
Here's a sample:
my $firewall = $NetConfig{ftp_firewall};
print "NetConfig says ftp firewall is $firewall\n";
$ftp = Net::FTP->new($host, Firewall => $firewall, Debug => 10);
&ckstatus($ftp, "could not open ftp connection to $host through
$firewall");
print "connected to $host, proceeding...\n";
$ftpstatus = $ftp->login($username, $passwd);
&ckstatus($ftpstatus, "Unable to log in as $username on $host");
$now_string = localtime;
print "$now_string logged in $host to process $jobname\n";
Note the Debug => 10, that prints out a lot of useful stuff.
I've written to Graham Barr about the lack of an interface for error
handling, but I never heard back :-) (there is no error handling on Unix?)
At any rate, the file transfer code includes statements like these:
$now_string = localtime;
print "$now_string sending $fields[1] -> $fields[2]\n";
$ftpstatus = $ftp->put($fields[1], $fields[2]);
&ckstatus($ftpstatus, "Unable to send $fields[2]");
print XOUT "$fields[0] $fields[2]\n";
$outline++;
$fields[1], [2] have the appropriate filespecs to send from VMS to DOS/nt
The ckstatus subroutine is a messy hack, and still does not catch
everything:
sub ckstatus{
my $flag = shift;
my $msg = shift;
print "ckstatus: perl status \$? is $?; \$\^S is $^S \$\@ is $@\n";
if (defined($flag)) {
print "ckstatus: flag is $flag\n";
}
# don't check if the function returned a string, such as a filename or
whatnot...
if ((defined($flag)) && ($flag =! 0)) {
print "ckstatus: $flag is OK, returning...\n";
return;
}
# check the VMS status
$xitsts = int($^E);
# allow retry of any VMS error:
if ( defined($xitsts) && ($xitsts != 0) && (($xitsts && 1) != 1)) {
print "$msg; VMS error status is: $^E\n";
printf "VMS status is %d %x, this should cause a retry\n",
$xitsts, $xitsts;
$syms{xitsts} = $xitsts;
die "Processing terminated";
}
if ((defined($flag)) && ($flag =~ /\S+/)) {
print "ckstatus: flag $flag is OK, returning...\n";
return;
}
if ((!defined($flag)) || ($flag == 0)) {
$xitsts = int($^E);
print $msg . "; failed status was: $^E\n";
if ($xitsts == 1) {
print "VMS returned success; some other error? allow a
retry\n";
$xitsts = $ss_badparam;
}
if ($xitsts == 0) {
print "ckstatus: $msg changing VMS sts from 0 to 1\n";
$xitsts = 1;
}
$syms{xitsts} = $xitsts;
die "Processing terminated";
}
}
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
HTH, Carl
-----Original Message-----
From: BAZLEY, Sebastian [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 15, 2000 9:49 AM
To: 'Joe Kazimierczyk'; [EMAIL PROTECTED]
Subject: RE: Net::FTP speed
> -----Original Message-----
> From: Joe Kazimierczyk [mailto:[EMAIL PROTECTED]]
> Sent: 14 August 2000 20:24
> To: [EMAIL PROTECTED]
> Subject: Re: Net::FTP speed
>
>
> Dan Sugalski wrote:
> >
> > Yech, that's abysmal. Try turning on debugging to see if
> anything shows
> > there. Also consider switching from the generic store
> method to one you
> > roll by hand. (There are directions in the Net::FTP docs
> for this) That way
> > you can see how long each piece of the put takes. You might
> be tripping
> > over some timer or something.
>
> Debugging on doesn't reveal any problems. I dread having to code my
> own store method, so I'll leave that as my last resort! I guess I'm
> just hoping there's a simple answer that I've missed.
If you want to double-check that the slowness is in the transfer stage,
rather than during startup or closedown, perhaps you could try some tests
with different sized files, including some short ones.
HTH
--
Sebastian Bazley <[EMAIL PROTECTED]>
The opinions expressed herein are my own, and are not necessarily endorsed
by my employer ...
___________________________________________________________________________
This email is confidential and intended solely for the use of the
individual to whom it is addressed. Any views or opinions presented are
solely those of the author and do not necessarily represent those of
Sema Group.
If you are not the intended recipient, be advised that you have received
this
email in error and that any use, dissemination, forwarding, printing, or
copying of this email is strictly prohibited.
If you have received this email in error please notify the Sema Group
Helpdesk by telephone on +44 (0) 121 627 5600.
___________________________________________________________________________