Return to Snippet

Revision: 580
at July 19, 2006 16:23 by kkindoh


Updated Code
use Carp;
use Net::FTP;

  my $ip  = ...; # Target machine

  my $local= ...; # local filename
  croak "$local file is missing !!\n" unless -f $local;

  my $remote= ...; # Remote filename

  my $ftp= Net::FTP->new( $ip
                         ,Port    => 21  # Standard port number
                         ,Timeout => 15  # Timeout in seconds
                        )
     or croak "Failed to connect to $ip.";

  my $user= ...;  # login user
  my $pw  = ...;  # login password
  $ftp->login( $user, $pw )
     or croak "Failed to login.";

  $ftp->put( $local, $remote)
     or croak "Failed to ftp.";

  $ftp->quit();

Revision: 579
at July 19, 2006 16:21 by kkindoh


Initial Code
use Carp;
use Net::FTP;

  my $ip  = ...; # Target machine

  my $local= ...; # local filename
  croak "$local file is missing !!\n" unless -f $local;

  my $remote= ...; # Remote filename

  my $ftp= Net::FTP->new( $ip
                         ,Port    => 21  # Standard port number
                         ,Timeout => 15  # Timeout in seconds
                        )
     or croak "Failed to connect to $name at $ip.";

  $ftp->login( "PrintMgr", "PrintMgr" )
     or croak "Failed to login to $name at $ip.";

  $ftp->put( $local, $remote)
     or croak "Failed to print on $name at $ip.";

  $ftp->quit();

Initial URL

                                

Initial Description
Simple way to do ftp from Perl

Initial Title
Net::FTP to ftp a file

Initial Tags
Net

Initial Language
Perl