I've written a script that uses net::FTPSSL from unix to windows, to upload a file to make sure ftp is working. It works fine. I was trying to generate an error where the file to upload was not found an instead of emailing me an error, it just printed one to the screen that the file wasn't found. I am trying to check the return code from the ftps but I am very new to this. This statement works if it can't put the file up but not if the file doesn't exist. $ftps->put("/temp/testuploadfile.txt") or emailerr("Error: $0 could upload testftpsfile to FTPS server at IP $ftpsip with FTPS p rotocol.", $ftps->$last_message() ); I was researching and checking debug output and see 226 is a successful put, but I don't know how to check that. How do I check the return code? I was trying to use something like this but it didn't work my $rtncode=$ftps->code; if ($rtncode != 226 && $rtncode != 250) { my $msg=$ftp->message; print "FTP Failed: $msg\n"; $ftp->quit; } OR ###print "error $Net::FTPSSL::ERRSTR"; Any help wourl be appreciated.

In reply to checking return from Net::FTPSSL by csgonan

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.