Re: FTP file handle question



Sturdevant, Robert W Mr CTR USA AMC wrote:
Hi group,

Hello,

I'm troubleshooting a perl 5.6 Win32 app that uses Net::FTP. I am trying
to ftp using a file handle instead of a local file name.

POD says something like $ftp->put(LOCAL_FILE [REMOTE_FILE]) where
LOCAL_FILE may be a file name or a file handle. I know $filename does
exist, I can see it!

This works: $ftp->put( $filename, $somename) ;

But this fails with "Cannot open local file HANDLE: No such file or
directory"

open( HANDLE, "< $filename");

You should verify that the file was opened correctly:

open HANDLE, '<', $filename or die "Cannot open '$filename' $!";

$ftp->put( HANDLE, $somename);

open() does open the file. fileno() says a descriptor is assigned. The
error is thrown by put(), specifically IO::Handle. Can someone tell me
what I am doing wrong??

perldoc -q "How do I pass filehandles between subroutines"



John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order. -- Larry Wall
.



Relevant Pages

  • Re: Good FTP program?
    ... >> overwrite a local file without crashing, ... > I have encountered that bug with KBear as well up to as recently as KDE ... > uploading and downloading files over FTP and it handles it pretty well. ... > One nice thing you can do with Konqueror is set up a separate FTP profile, ...
    (alt.os.linux.suse)
  • Re: If file exist in FTP location download, otherwise quit
    ... "Clay Calvert" wrote: ... My problem is if the file at the ftp location does ... ftp for some reason overwrites the local file and blanks it out (0 ... I need a way to make sure that if file is not in ftp location to leave ...
    (microsoft.public.scripting.wsh)
  • Re: Help: FTP File List
    ... Amy Lee wrote: ... and I wanna get a file list from ftp. ... prompting is on, ftp will prompt the user to verify that the ... If no local file is specified, ...
    (comp.os.linux.networking)
  • Re: ftp problem
    ... I ftp to a FC2 pc, login ... when I put a local file to this FC2 PC. ...
    (Fedora)
  • [ANN] edtFTPj/PRO 1.2.8 released (FTPS and SFTP client)
    ... release of edtFTPj/PRO 1.2.9, which is an enhanced version of edtFTPj ... that supports an enhanced API including directory transfers, ... FTPS, ... Fixed bug in SSHFTPClient where a getleaves a new local file ...
    (comp.lang.java.announce)