Dan Muey wrote:
> To answer my own questions :
>>
>>
>> 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?
> Remote
>>
>> 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, 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?
> Why not, couldn't connect so it was blank or ???
> But this works, and was not easy to figure out from the web or docs,
> So I hope this helps someone out :
> To create a file on the remote server with contents that were
> generated in the current script :
>
>                 $stor = $ftp->stor("$remote_file_name");
>                 $stor->write($contents, length($contents)); # if it's
> a big file you may want to break this up
>                 $stor->close();

Glad you managed to find a solution yourself, but it definitely does
work with 'print' as the object that 'stor' returns is (amongst
other things) an IO::Handle. Does your $remote_file_name
contain the path to the file? If it works like that I'd be surprised,
but the object method may just be cleverer than I thought,
although in that case I don't understand why you were getting an
undefined $stor before.

Rob





-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to