Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: How can I retrieve a file from a UNIX server using Perl on a Windows NT client?

by chromatic (Archbishop)
on May 12, 2000 at 00:24 UTC ( [id://11202]=note: print w/replies, xml ) Need Help??


in reply to How can I retrieve a file from a UNIX server using Perl on a Windows NT client?

Net::FTP from CPAN might come in handy. From the perldoc page (but with error checking added):
use Net::FTP; $ftp = Net::FTP->new("some.host.name", Debug => 0) or die "Can't FTP to some.host.name: $@\n"; $ftp->login("anonymous",'me@here.there') or die "Anonymous access denied!\n"; $ftp->cwd("/pub") or die "Can't chdir to remote /pub.\n"; $ftp->get("that.file"); or die "Can't fetch that.file.\n"; $ftp->quit;
Looks pretty easy.

Edit 2001-03-11 by tye to add error checking. tye is quite disappointed that Net::FTP does not give you access to the reasons for any failures other than of new().

  • Comment on Re: How can I retrieve a file from a UNIX server using Perl on a Windows NT client?
  • Download Code

Replies are listed 'Best First'.
Re: Answer: How can I retrieve a file from a UNIX server using Perl on a Windows NT client?
by scottstef (Curate) on Mar 11, 2001 at 21:32 UTC
    I have pretty much the same code---However I get a

    can't call method "login" on an undefined value at ftp.pl line (number of line login is)

    error when I try to execute the script. I used the same script with different variables on a unix host, and it worked fine, however it won't work on NT.

      Well, you might be able to figure out why it is failing if chromatic hadn't left out all error checking. Bad, bad chromatic. No biscuit! (Of course it doesn't help that the Net::FTP docs are just as bad... Bad, bad Graham. No biscuit!)

      $ftp = Net::FTP->new("some.host.name", Debug => 0) or die "Can't create Net::FTP object: $@\n";
              - tye (but my friends call me "Tye")

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11202]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (4)
As of 2024-04-20 04:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found