Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env perl
- use strict;
- use warnings;
- use Net::FTP;
- my $hostname = 'foo';
- my $username = 'bar';
- my $password = 'baz';
- # successful first pass
- my $ftp = Net::FTP->new( $hostname ) or die "cannot connect to $hostname: $@";
- $ftp->login( $username, $password ) or die "cannot login: ", $ftp->message;
- map { print "ls_output: $_n" } $ftp->ls; # success
- $ftp->quit or die "cannot close connection: ", $ftp->message;
- # re-use attempt
- $ftp->login( $username, $password ) or die "cannot login: ", $ftp->message;
- # never gets here since re-use attempt fails
- print "done!n";
Add Comment
Please, Sign In to add comment