Hi, I'm not a perl programmer but I'm trying to modify an existing script from Net::FTP to NET::FTPSSL. Now there are problem to get the files. I got this error: syswrite() on closed filehandle GEN0 at Can't write command on socket: Bad file number This is part of the code:
# GET FILE LIST if ( !$error_flag ) { if ( !$debug ) { @files = $ftp->list() or $error_flag = + 1; $ftp->quit if $error_flag; } else { opendir( DIR, "$debug_ftp_directory/$d +irectory_local" ) or $error_flag = 1; @files = readdir(DIR); closedir(DIR); } $report = $report . " ERROR: Can't get file l +ist $!\n" if $error_flag; $error_cnt++ if $error_flag; } # GET ALL FILES (*.enc) TO LOCAL DIRECTORY, DELETE THE +M ON SERVER foreach $file (@files) { if ( !$error_flag && $file =~ m/\.enc$/ ) { $report = $report . " Retrieving file + $file\n"; if ( !$debug ) { $ftp->get($file) or $error_fla +g = 1; $ftp->quit if $error_flag; $ftp->delete($file) or $error_ +flag = 1; $ftp->quit if $error_flag; } else { move( "$debug_ftp_directory/$d +irectory_local/$file", '.' ) or $error_flag = 1; } if ( !$error_flag ) { $downloaded_cnt++; } else { $report = $report . " ERROR: Can't re +trieve file $file $!\n"; $error_cnt++; } } } if ( ( !$error_flag ) && ( !$debug ) ) { $ftp->quit; }
Would be greatful if someone can help me. This worked out with Net::FTP Thanks in advance Bettan

In reply to FTPSSL Bad file number by Bettan

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.