Re: Help with Net::ftp not downloading
- From: "J. Gleixner" <glex_no-spam@xxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 05 May 2009 11:31:18 -0500
Ed Jay wrote:
J. Gleixner wrote:
Ed Jay wrote:[...]J. Gleixner wrote:
Ed Jay wrote:
I'm still a novice at Perl. I'm trying to develop a simple script to
download a set of files from my server to my local drive. Although I'm not
getting any error messages, the script isn't performing. Help, please!
(BTW, using this script I have been able to change and delete file names
on the server, so I know I'm properly logged in.)
[...]Hammer meet nail! I added the error message trap, an lo, I get an errorchdir($localDir);What if that fails?
message saying it can't change the local directory. Doesn't tell me why,
only what the path is on the server.
If you die with the reason, which is set in $!, you'll usually
get a pretty good explanation why it failed.
chdir( $localDir ) or die "Can't cd to $localDir: $!";
Without the CGI module installed, I get no error message. The script just
dies at the cd directive. With the CGI module installed and fatals to the
screen, after setting $localDir = C:\, I receive the error message,
chdir( $localDir ) or die "Can't cd to $localDir: $!"; I'm sure that must
be telling, but I can't fathom what it's telling me...I do have a drive C.
Hu? That looks like it's not executing the script. You shouldn't
see your code, in the browser. If you're running it via your
Web server, then 'use CGI' will help, otherwise you'll have
to print the header and HTML yourself.
Maybe the output is in your Web server's error log?
When in doubt, simplify the code to exactly what you're
trying to test.
use CGI qw(:standard);
# without the next line, die output will be found in your
# server's error log. Use this only when debugging.
use CGI::Carp qw(fatalsToBrowser);
use strict;
my $localDir = 'C:/somedir'; #change that to the appropriate location
print header,
"Changing directory to $localDir.<br>";
chdir( $localDir ) or die "Can't cd to $localDir: $!";
print "Change to $localDir successful.<br>";
.
- References:
- Re: Help with Net::ftp not downloading
- From: J. Gleixner
- Re: Help with Net::ftp not downloading
- From: J. Gleixner
- Re: Help with Net::ftp not downloading
- Prev by Date: passing "#" into subroutine
- Next by Date: Re: passing "#" into subroutine
- Previous by thread: Re: Help with Net::ftp not downloading
- Next by thread: Re: Help with Net::ftp not downloading
- Index(es):
Relevant Pages
|