I am seeing a bug or issue with Net::FTP and thought I would try this list
about what may be the cause. I wrote the following little script to push a
host file, concatenated with some scripting, to another server where the
file can be viewed.

The problem is when I send it via this script, the file is truncated when it
gets to the destination. If I ftp it manually, it's fine. I have tried this
from unix to unix, unix to pc (the desired situation) and pc to unix. Tried
it on Perl 5.005, 5.6 and ActivePerl on the PC.  I notice that the
destination file is the same size as ALLO says- which is smaller than the
actual file. Below are the directory listings, followed by my script and the
debug output. Any ideas? Is this a module bug? I've emailed the owner of
Net::FTP also...

If there's another list better suited to helping me, please advise. There
are so many!!

Thanks in advance,

Mike Bernhardt

Here's the directory listing at the source:
-rw-r--r--   1 username  other     210380 Jul 22 12:15 iphostlist.html
-rw-r--r--   1 username  other         51 Jul 21 16:13
post.host.list.template
-rw-r--r--   1 username  other       4996 Jul 21 16:57
pre.host.list.template

And at the destination:
-rw-r--r--   1 username staff     204800 Jul 22 12:19 iphostlist.html

The script:
use Net::FTP;
open (PRE,"pre.host.list.template") or die "Couldn't open PRE";
open (POST,"post.host.list.template") or die "Couldn't open POST";
open (HOSTS, "/etc/hosts") or die "Couldn't open /etc/hosts";
open (NEW,">iphostlist.html") or die "Couldn't write to new file";
@pre = <PRE>;
@post = <POST>;
@hosts = <HOSTS>;
print NEW foreach @pre;
print NEW foreach @hosts;
print NEW foreach @post;
close PRE;
close POST;
close HOSTS;
&FTP;
#
sub FTP {
$ftp = Net::FTP->new    ("server",
                        Debug => 1,
                        Timeout => 10)
           or die "Cannot connect to server: $@";

         $ftp->login("username",'password')
           or die "Cannot login ", $ftp->message;

         $ftp->ascii()
           or die "ascii failed ", $ftp->message;

         $ftp->put("iphostlist.html")
           or die "put failed ", $ftp->message;

         $ftp->quit;
}

Here's the CLI output:
# perl test
Net::FTP>>> Net::FTP(2.71)
Net::FTP>>>   Exporter(5.562)
Net::FTP>>>   Net::Cmd(2.24)
Net::FTP>>>   IO::Socket::INET(1.25)
Net::FTP>>>     IO::Socket(1.26)
Net::FTP>>>       IO::Handle(1.21)
Net::FTP=GLOB(0x1c9e4c)<<< 220 server FTP server (SunOS 5.8) ready.
Net::FTP=GLOB(0x1c9e4c)>>> user username
Net::FTP=GLOB(0x1c9e4c)<<< 331 Password required for username.
Net::FTP=GLOB(0x1c9e4c)>>> PASS ....
Net::FTP=GLOB(0x1c9e4c)<<< 230 User username logged in.
Net::FTP=GLOB(0x1c9e4c)>>> TYPE A
Net::FTP=GLOB(0x1c9e4c)<<< 200 Type set to A.
Net::FTP=GLOB(0x1c9e4c)>>> ALLO 204800
Net::FTP=GLOB(0x1c9e4c)<<< 202 ALLO command ignored.
Net::FTP=GLOB(0x1c9e4c)>>> PORT x.x.x.x,128,239
Net::FTP=GLOB(0x1c9e4c)<<< 200 PORT command successful.
Net::FTP=GLOB(0x1c9e4c)>>> STOR iphostlist.html
Net::FTP=GLOB(0x1c9e4c)<<< 150 ASCII data connection for iphostlist.html
(x.x.x.x,33007).
Net::FTP=GLOB(0x1c9e4c)<<< 226 Transfer complete.
Net::FTP=GLOB(0x1c9e4c)>>> QUIT
Net::FTP=GLOB(0x1c9e4c)<<< 221 Goodbye.
#


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to