I'm trying to get a simple file download script working using Net::FTP. Here's my script:

#!/usr/bin/perl print "Content-type: text/plain\n\n"; use strict; use warnings; use Net::FTP; my $host ='192.168.0.110'; my $user ='root'; my $pw ='xxxxxx'; my $file ='hello.pl'; my $path ='/home/admin/temp'; my $ftp = Net::FTP->new($host, Debug => 1) or die "Could not connect to '$host': $@"; $ftp->login($user, $pw) or die print "Could not login1: %s", $ftp->message; $ftp->cwd($path) or die print "Could not change directory to %spath", $ftp->message +; $ftp->get("hello.pl") or die print "Could not get $file from $path ", $ftp->message; print "End";
The script seems to run and in fact I can successfully modify it to make and remove directories on the server. What I can't do is get it to download from the server to a local file. Server permissions are set properly, the file exists and the local directory exists. What I get is this error line, and it never gets to the terminating print line.: "Could not get hello.pl from /home/admin/temp Transfer complete. No transfer to ABOR." Can someone point me in the right direction? Joe


In reply to Net::FTP get problem by joedarock

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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, details, 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, summary, 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.