Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

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 ( #11174=categorized question: print w/replies, xml ) Need Help??
Contributed by Anonymous Monk on May 11, 2000 at 20:13 UTC
Q&A  > HTTP and FTP clients


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.

Answer: How can I retrieve a file from a UNIX server using Perl on a Windows NT client?
contributed by mikeock

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.

Answer: How can I retrieve a file from a UNIX server using Perl on a Windows NT client?
contributed by chromatic

Net::FTP from CPAN might come in handy. From the perldoc page (but with error checking added):

use Net::FTP; $ftp = Net::FTP->new("", Debug => 0) or die "Can't FTP to $@\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().

Please (register and) log in if you wish to add an answer

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    [Lady_Aleena]: And what would I rename RolePlaying/Random .pm to if I move all the RolePlaying/Random modules to just Random? Random/ Random/, maybe lowercase the file name to indicate it is a bit different? I don't know yet.
    [marioroy]: What does Random do?
    [karlgoethebier]: https://www. v=42WNHGr1jGI
    [Lady_Aleena]: karlgoethebeir, I finished another project tonight, making a module which printed stop printing. It was a headache and a half.
    [karlgoethebier]: Lady_Aleena: Try it!
    [Lady_Aleena]: marioroy, it has 3 subroutines which can be fed data to generate random things. See here.
    [Lady_Aleena]: marioroy, it is used in 24 other modules I wrote.
    [Lady_Aleena]: GUH! I wrote a script better than I thought! 8)

    How do I use this? | Other CB clients
    Other Users?
    Others meditating upon the Monastery: (7)
    As of 2017-05-29 09:02 GMT
    Find Nodes?
      Voting Booth?