Try:
open(STDOUT, ">>$logpath") or die "Cannot redirect STDOUT: $!"; open(STDERR, ">>$logpath") or die "Cannot redirect STDERR: $!";
Any errors or screen output therefore produced will be pushed to $logpath.
You might also find this section of code handy:
use Net::FTP; # lets seperate any URL from the hostname ($host,$url)=split('/',$data{'FTPUrl'},2); $ftp=Net::FTP->new($host,Debug=>1); $results=$ftp->login($data{'FTPUsername'},$data{'FTPPassword'}); print "Mesage: ".$ftp->message()."\n"; if (!$results) { $failedlog.="* Unable to login to remote FTP site ($host) with\n"; $failedlog.=" Username: $data{'FTPUsername'}\n"; $failedlog.=" Password: $data{'FTPPassword'}\n"; $failedlog.=" Error: ".$ftp->message()."\n";$failed=1; print $failedlog; } print "Logged on using $data{'FTPUsername'}, $data{'FTPPassword'}\n" +; if (length($url)>1) { $ftp->cwd($url);print "Changed to $url\n"; } $pwd=$ftp->pwd(); print "CWD is: $pwd\n"; $ftp->hash(STDOUT); $ftp->binary; print $ftp->ls;print "\n"; $results=$ftp->put($filepath,$filename if (!$results) { $failedlog.=" * Unable to uploaded $advert{$i.'-Advertname'})\n"; $failedlog.=" Error: ".$ftp->message()."\n";$failed=1; $failedlog.=" Directory: $pwd\n"; } $ftp->quit;
Use the STDERR and STDOUT logging above and you've got a full and complete track of what happened in the ftp upload etc. Then you just need to email the log file and the job's done.

In reply to Re: Net::FTP Help by beebware
in thread Net::FTP Help by muzakfetch

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.