On Thu, Apr 21, 2005 at 10:56:16AM -0500, JupiterHost.Net wrote: > > > Peter Rabbitson wrote: > > >Hello everyone, > > Hello, > > >Very simple: I need to generate a file and upload it to ftp. Currently I > >am wrapping the file together, writing it out to a temp file on disk, > >calling $ftp->put($tmp_file) on it, and unlinking it. Is there a way to > >skip the write to disk? The put() method seems to expect a path only, > >rather than > > You'd use stor/write/close: > > my $stor = $ftp->stor($new_file_on_ftp_server); > $stor->write($new_file_guts, length($new_file_guts)); > $stor->close(); > > See `perldoc Net::FTP` for more info > > HTH :) > > Lee.M - JupiterHost.Net >
Errrr... This looks a little complicated. I mean I would have to get size of the string in question and the data is utf8, meaning more headaches. Or I simply don't know how to do it which leads to the same result :) Nevertheless I somehow overlooked the part in the documentation where it says that put() takes a filehandle as well: open (VIRTUAL, '<:utf8', \$data); $ftp->put (\*VIRTUAL, $conf->{target_tsv}) or die 'Could not upload file' $ftp->quit; close (VIRTUAL); Works like a charm. Thanks! Peter -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>