Hi I am really despaired,
I have no idea what to do anymore. I need to download a plain Textfile size ~20 mb from a TSO machine to my Windows 2000 system daily. I use the newest Activestate Perl distribution (5.8)
I use the following code:
use strict;
use Net::FTP;
my $hostname = 'localhost';
my $username = 'slip';
my $password = 'knot';
my $file = 'version.txt';
my ($ftp, $code, $msg);
$ftp = Net::FTP->new($hostname);
if($@) {
print "Error connecting to $hostname: $@";
exit;
}
$ftp->login($username,$password);
$code = $ftp->code;
unless ($code == 230) {
$msg = $ftp->message;
print "Error logging in: $code $msg";
exit;
}
$ftp->ascii();
$ftp->get($file);
$code = $ftp->code;
unless ($code == 150 || $code == 226 || $code == 250)
{
$msg = $ftp->message;
print "Error getting $file: $code $msg";
exit;
}
$ftp->quit;
______________________________________________________
OK now the weird thing and I have no idea what to do anymore. The File doesn´t seem to have a end of line. Neither Notepad nor Perl "can see" the End of Line. If I get the File manually via DOS command box and the ftp command the file does have a normal End of Line.
If I open the file downloaded with the Perl code with a Texteditor like Ultraedit, Ultraedit thinks that this is a Hex File. Changing to "normal" mode the End of Line exists.
So I think the Problem is with Net::FTP it gets the file correctly but doesnt convert the End Of Line correctly to ASCII.
Question: Is there any way to fix this Problem, is it a problem in the Net::FTP or what can I do to get the File correctly???
Thanx in advance Ausby
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.