> Hi Jas.
> 
> Jas wrote:
> >

[snip]

> 
> > $ftp->put(`../path/to/*-www.tar.gz`)
> >   or die "Could not transfer files ", $ftp->message;
> 
> .. backticks in two statements!
> 
> > $ftp->quit;
> >
> > Error...
> > Net::FTP>>> Net::FTP(2.71)
> > Net::FTP>>> Exporter(5.566)
> > Net::FTP>>> Net::Cmd(2.24)
> > Net::FTP>>> IO::Socket::INET(1.26)
> > Net::FTP>>> IO::Socket(1.27)
> > Net::FTP>>> IO::Handle(1.21)
> > Net::FTP=GLOB(0x8133e3c)<<< 220-Development FTP Server
> > Net::FTP=GLOB(0x8133e3c)<<< FTPd 1.81.00 (Mar  3 2002) Ready
> > Net::FTP=GLOB(0x8133e3c)<<< 220 Please enter your user name.
> > Net::FTP=GLOB(0x8133e3c)>>> user user
> > Net::FTP=GLOB(0x8133e3c)<<< 331 User name okay, Need password.
> > Net::FTP=GLOB(0x8133e3c)>>> PASS ....
> > Net::FTP=GLOB(0x8133e3c)<<< 230 User  logged in.
> > sh: line 1: ../path/to/02192004-www.tar.gz: Permission denied
> > fileparse(): need a valid pathname at /usr/lib/perl5/5.8.0/Net/FTP.pm
> > line 705
> 
> IMO it's best to use single quotes for strings unless you particularly
need
> to interpolate variables or include control characters.
> 
> The backticks are your problem: they will make Perl shell out to execute
> the string as a command. The 'sh: line1:' in your error message is the
> clue. Presumably you don't have execute permission for
> '../path/to/02192004-www.tar.gz'?
> 
> Try this and see if it works any better:
> 
>   my $ip = '192.168.0.2';
> 
>   $ftp = Net::FTP->new($ip, Debug => 1)
>     or die "Could not establish connection to $ip: $@";
> 
>   $ftp->login('user', 'password')
>     or die 'Could not login ', $ftp->message;
> 
>   $ftp->put('../path/to/*-www.tar.gz')
>     or die 'Could not transfer files ', $ftp->message;
> 

Yes, but the OP might be trying to glob based on the *. Unless he really
does have a file named '*-www.tar.gz', but I took this to mean a file
glob, in which case his use of 'put' is wrong.  'put' takes a single
file or filehandle and optionally a remote file name.  The OP will need
to file glob into a list then step through the list to transfer multiple
files.

foreach my $file (glob('../path/to/*-www.tar.gz')) {
  $ftp->put($file) or die ....;
}

But maybe I am reading too much into it...

http://danconia.org

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to