johnsned has asked for the wisdom of the Perl Monks concerning the following question:

I wrote an FTP client that transfers files from a Win2K box to an AIX box. I need to 'ASCII' mode to get rid of the CRLF right? how do I do that, what is the syntax.

Here is the portion of the code that does the FTP

$ftp = Net::FTP->new("$Server",Debug => 0);
$ftp->login("mqm","$Pwd",) || die "LOGIN FAILED";
$ftp->ascii;
$ftp->cwd("/var/mqm/mqsc/stage")|| die "CAN'T CHANGE DIR";
$ftp->put("C:\\Jobs\\staging\\$File")|| die "PUT FAILED";
$ftp->quit;

...but that doesn't seem to work. I have searched CPAN and other internet sources and not found any help, in one site it mentioned this as a "Known Bug".

Also I was wondering if it is possible to chmod the file using this FTP module?

Any help would be appreciated.

Thanks,

John

Replies are listed 'Best First'.
Re: Net::FTP $ftp->ascii;
by Thelonius (Priest) on Nov 14, 2003 at 20:35 UTC
    This is a known bug in Perl 5.8.0 on Windows. See my 240895 for a workaround.

      Thelonius,

      It worked! Thank you, Thank you!!

      I have been going nuts trying to figure this out. I really appreciate your response.

      Sincerely,

      John Snediker

Re: Net::FTP $ftp->ascii;
by Grygonos (Chaplain) on Nov 14, 2003 at 19:06 UTC
    I just wrote something very similar to this... to transfer off AIX on to 2k/XP. Mine were coming with the CRLF stripped w/o ever using $ftp->ascii. When I open it in TextPad on the M$ machine.. it shows the file is in PC-ANSI format. What version of Net::FTP are you running? I am using the latest on cpan Net::FTP as of yesterday.

    Grygonos
Re: Net::FTP $ftp->ascii;
by meetraz (Hermit) on Nov 14, 2003 at 19:29 UTC
    To chmod a file, you should use the site() command:

    $ftp->site("CHMOD 644 yourfile.txt");
      Alas many (most) ftp servers do not allow site commands anymore YMMV.


      -Waswas
Re: Net::FTP $ftp->ascii;
by nimdokk (Vicar) on Nov 14, 2003 at 19:29 UTC
    Have you tried sending it as binary? That might seem counter-intuitive, but you never know. As for chmod, according to the POD for Net::FTP, there is no such animal.


    "Ex libris un peut de tout"