in reply to ftp put without a local file
So, the other way is to fork a process and have it do the writting into W. Like the following (untested code ahead) :### i know this does not work, i am showing the idea my $ftp = Net::FTP->new($server,$user,$pass); $ftp->cwd("/some/dir"); pipe(R,W); $ftp->put(\*R,'filename'); print W "data here\n"; $ftp->quit;
... i have not tested this, but it should work. I guess if you are on unix you could also use mknod to make a named pipe, and use that.pipe(READ,WRITE); $pid = fork(); if ($pid == 0) { ## child (read) close(WRITE); $ftp->cwd("/some/dir"); $ftp->put(\*READ,'filename'); $ftp->quit; } else { ## parent (write) close(READ); ## ... do some cool processing for $data print WRITE $data; close(WRITE); }
|
|---|