Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Inconsistancy within Net::FTP?

by rdw (Curate)
on Aug 24, 2000 at 12:50 UTC ( #29385=note: print w/replies, xml ) Need Help??


in reply to Inconsistancy within Net::FTP?

As others have pointed out, this is because Net::FTP is calling fileno. I just tried this and it worked for me - I don't think it will solve all your problems, but it might be a good starting point.
my $data="FOOBAR"; pipe PIPEREAD, PIPEWRITE; print PIPEWRITE $data; close PIPEWRITE; my($ftp) = Net::FTP->new($destserv) || die "error connecting\n"; $ftp->login($destuser, $destpass); $ftp->binary(); $ftp->put(*PIPEREAD,"remotelogfile") or die "error uploading\n"; $ftp->quit();
Basically, I used pipe to create a real pipe between Perl and whatever Net::FTP is doing.

Have fun,

Rich

Replies are listed 'Best First'.
RE: Re: Inconsistancy within Net::FTP?
by merlyn (Sage) on Aug 24, 2000 at 17:39 UTC
    That works as long as you don't have more than 8K of data (doh!), because a pipe can buffer up to that before blocking. More than that, you'll block on the write at your print PIPEWRITE, and there won't be anyone around to be reading it, so you'll wait forever. Bzzzzz.

    -- Randal L. Schwartz, Perl hacker

      Like I said, it won't solve all the problems :-)

      Since Net::FTP is blocking, you can't really do this without two processes.

      Rich

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://29385]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (8)
As of 2016-12-03 09:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (55 votes). Check out past polls.