Re: FTP from Perl script on Windows




"Ivan L" <ilackic@xxxxxxxxx> wrote in message
news:Xns984C6A9E0F938ivanlac@xxxxxxxxxxxxxxxxxx

I have tried to use FTP from Perl (not using System() but directly from
perl script), and
found out that all the sample programs found on the Internet don't work.
Further investigation showed
that there is following error

"Cannot connect to host: Net::FTP: Bad protocol 'tcp' at ftptest1.pl line
3."

The part of the perl script that caused this error is:

1.#!/usr/bin/perl -w
2. use Net::FTP;
3. $ftp = Net::FTP->new("Host", Debug => 0) or die "Cannot connect to
host: $@";


Can't see anything that should pose a problem (assuming "Host" is replaced
by the valid string for whatever your host really is).

The following works fine for me on Win32:

use warnings;
use Net::FTP;
$ftp = Net::FTP->new("rtfm.mit.edu", Debug => 1)
or die "Cannot connect to host: $@";
$ftp->login('anonymous','anonymous');
$ftp->cwd("/pub/usenet-by-group/");
$ftp->quit;

What does that script produce for you ?

Cheers,
Rob


.



Relevant Pages

  • Re: nameserver changing
    ... Re: nameserver changing: ... >> None of the machines are running their own dns servers. ... >script that will be scp'ed and executed on each host. ... >and then create one Perl script for every host. ...
    (freebsd-questions)
  • How to setup PerLDAP
    ... Copy a test Perl script getentry.pl on page 380: ... die "Could not connect to LDAP $host" unless $conn ... It obvious that I missed something while setting up PerLDAP. ... Directory Server: ...
    (SunManagers)
  • Re: nameserver changing
    ... > list of dns's used as resolvers by particular machineon a network which I ... > None of the machines are running their own dns servers. ... script that will be scp'ed and executed on each host. ... and then create one Perl script for every host. ...
    (freebsd-questions)
  • Re: Bash: How do I quote CR &| LF in a command?
    ... >> I want to do in bash what the above perl script does. ... Thanks for your reply too Stephane - I need the Host: header because ... I'm working with LVS real servers inside the realserver network, ...
    (comp.unix.shell)
  • scripting gethostbyname
    ... Here's a 3 line perl script that prints the IP address of a named host: ... use Socket; ...
    (microsoft.public.scripting.vbscript)