Not sure but see if Windows has the standard UNIX dos2unix and unix2dos
utilities. If so, can you pipe your files through there before hand?

Steve


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Sui
Ming Louie
Sent: Thursday, April 22, 2004 11:26 AM
To: '$Bill Luebkert'
Cc: [EMAIL PROTECTED]
Subject: RE: ASCII Mode for Net::FTP

Thank you, $Bill.  However, I tried your suggestion and my files are
still
in Unix format.  Is there a way to rectify this besides sending the
files
through a filter to translate the 0Ah to 0Dh,0Ah.

        while (<>) {
          chomp;
          print "$_\n";
        } # while

Sui


-----Original Message-----
From: $Bill Luebkert [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 22, 2004 10:40 AM
To: Sui Ming Louie
Cc: [EMAIL PROTECTED]
Subject: Re: ASCII Mode for Net::FTP

Sui Ming Louie wrote:

> According to perldoc Net::FTP, the method $ftp->ascii has arguments.
I
> tried putting a 1 as the argument.  It appears the files that are
still
> being transferred in binary mode.  I am running Windoze XP and Perl
> v5.8.0 build 804.  The options I am using are
> 
>  
> 
> -aIPADDR
> 
> -uusername
> 
> -ppassword
> 
> -ddefault_remote_directory
> 
> -t (text or ascii mode)
> 
> -h (display hash)
> 
>  
> 
> The remote machine is an SGI workstation.  Any assistance will be
> greatly appreciated. 
> 
>  
> 
> Abridged perl code follows:
> 
>  
> 
> use Net::FTP;
> 
> use Getopt::Std;
> 
> getopts ('a:u:p:d:th', \%opts);
> 
>  
> 
> my $default_dir = "/xxxx/Project"; # changed for this posting
> 
>  
> 
>   # ====================
> 
>   # default IP address: changed for this posting
> 
>   # ====================
> 
> $opts{'a'} = "xxx.yyy.zzz.41"  if (not defined $opts{'a'});
> 
>  
> 
>   # =======================================================
> 
>   # append default directory if only base directory given
> 
>   # =======================================================
> 
> $opts{'d'} = $default_dir if (not defined $opts{'d'});
> 
> $opts{'d'} = $default_dir . '/' . $opts{'d'} if (not ($opts{'d'} =~
/^\//));
> 
>  
> 
> my $ftp = Net::FTP->new ($opts{'a'}, Debug => 0);
> 
> $ftp->login ("tensyl", "xxxxxx"); # changed for this posting
> 
> $ftp->cwd ($opts{'d'});
> 
>  
> 
>   # ======================
> 
>   # ascii (or text) mode
> 
>   # ======================
> 
> $ftp->ascii(1)  if (defined $opts{'t'});

This should be sufficient:

$ftp->ascii if defined $opts{'t'};

>  
> 
> my $getrv;
> 
> while (defined $ARGV[0]) {
> 
>   $getrv = $ftp->get ($ARGV[0]);
> 
>   if (defined $getrv) {
> 
>     print "$getrv\n";
> 
>   } else {
> 
>     print ("Error in getting file: <$default_dir/$ARGV[0]>\n");
> 
>   } # if
> 
>  
> 
>   shift @ARGV;
> 
> } # while
> 
>  
> 
> $ftp->quit;


-- 
  ,-/-  __      _  _         $Bill Luebkert
Mailto:[EMAIL PROTECTED]
 (_/   /  )    // //       DBE Collectibles    Mailto:[EMAIL PROTECTED]
  / ) /--<  o // //      Castle of Medieval Myth & Magic
http://www.todbe.com/
-/-' /___/_<_</_</_    http://dbecoll.tripod.com/ (My Perl/Lakers stuff)



_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to