Guest User

Untitled

a guest
Jan 19th, 2019
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. #!/usr/bin/env perl
  2.  
  3. use strict;
  4. use warnings;
  5.  
  6. use Net::FTP;
  7.  
  8. my $hostname = 'foo';
  9. my $username = 'bar';
  10. my $password = 'baz';
  11.  
  12. # successful first pass
  13. my $ftp = Net::FTP->new( $hostname ) or die "cannot connect to $hostname: $@";
  14. $ftp->login( $username, $password ) or die "cannot login: ", $ftp->message;
  15. map { print "ls_output: $_n" } $ftp->ls; # success
  16. $ftp->quit or die "cannot close connection: ", $ftp->message;
  17.  
  18. # re-use attempt
  19. $ftp->login( $username, $password ) or die "cannot login: ", $ftp->message;
  20.  
  21. # never gets here since re-use attempt fails
  22. print "done!n";
Add Comment
Please, Sign In to add comment