Hi Dan.
Dan Muey wrote:
> I have 2 questions about this chunk of code I'm trying to get to work
> ::
> I understand that Net::FTP 's stor ...
>
> Tells the server to store a new file under the name file. If the user
> calls either pasv or port,
> returns true or false. Otherwise, returns a reference to a
> Net::FTP::dataconn object.
>
> 1) Is 'server' above the remote server or the local server?
The remote server. There is no 'local server' by definition -
the local entity is the client.
>
> What I'm trying to do is 'stor' "TEST TEST" in $diry/$ptr1
>
> Here's the code ::
>
> 28 - $stor = $ftp->stor("$diry/$ptr1");
> 29 - print $stor "TEST TEST";
> 30 - close $stor;
>
> When I run the script I get this error :
>
> Can't use an undefined value as a symbol reference at ./ftp.pl line
> 29.
>
> I'm figuring that means that $stor isn't defined,
Yes, that's right.
> what I can't figure out is
>
> 2) why not, or what else can I do to create the file and get TEST
> TEST into it?
The FTP command STOR doesn't accept a path, only a file name, so
nor does the 'stor' method. Try this:
use strict; # Always !!!
my ($ftp, $diry, $ptr1);
$ftp->cwd($diry) or die $!;
{
my $stor = $ftp->stor($ptr1) or die $!;
print $stor "TEST TEST" or die $!;
close $stor or die $!;
}
The die messages will tell you if anything's gone wrong, and hopefully
why.
HTH,
Rob
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]