Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

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

by Anonymous Monk
on May 11, 2000 at 20:13 UTC ( [id://11174]=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I need to copy a file from a UNIX server on to a Windows NT client, while logged on to the client using Perl. Is there an FTP module in Perl which runs on Windows NT, which can help me do this?

Alternatively, what is the best way to accomplish this? Please remember, I need to access this file from the client.

Originally posted as a Categorized Question.

Replies are listed 'Best First'.
Re: How can I retrieve a file from a UNIX server using Perl on a Windows NT client?
by mikeock (Hermit) on Nov 01, 2005 at 02:06 UTC
    Error checking can be acheived through the following code:

    $ftp->login($user,$pass) or die "Either $user or password is incorrect" ,$ftp->message;

    Note the $ftp->message. I dunno if this is new to this module but it is worth noting so that if new users are still using these sections, the FAQ's should reflect some of the new features that the modules support.

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
    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().

      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: perlquestion [id://11174]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2024-03-29 01:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found