about summary refs log tree commit
diff options
context:
space:
mode:
authorGraham Barr <gbarr@pobox.com>2003-05-20 11:24:08 +0000
committerGraham Barr <gbarr@pobox.com>2003-05-20 11:24:08 +0000
commit1c06f77a10dc580e580a10e776a2b986e5eab5e2 (patch)
tree1831a58857cb822c4088b2a39dc5099c0a629176
parentaa74f4ee6d37a3f2a1c1fe1668c14fdcd8345075 (diff)
downloadperl-libnet-1c06f77a10dc580e580a10e776a2b986e5eab5e2.tar.gz
Net::FTP
- Add some error checking to the examples in the SYNOPSIS

-rw-r--r--Net/FTP.pm20
1 files changed, 14 insertions, 6 deletions
diff --git a/Net/FTP.pm b/Net/FTP.pm
index 608882f..07e1a6f 100644
--- a/Net/FTP.pm
+++ b/Net/FTP.pm
@@ -22,7 +22,7 @@ use Net::Config;
 use Fcntl qw(O_WRONLY O_RDONLY O_APPEND O_CREAT O_TRUNC);
 # use AutoLoader qw(AUTOLOAD);
 
-$VERSION = "2.68"; # $Id: //depot/libnet/Net/FTP.pm#71 $
+$VERSION = "2.68"; # $Id: //depot/libnet/Net/FTP.pm#72 $
 @ISA     = qw(Exporter Net::Cmd IO::Socket::INET);
 
 # Someday I will "use constant", when I am not bothered to much about
@@ -1199,10 +1199,18 @@ Net::FTP - FTP Client class
 
     use Net::FTP;
 
-    $ftp = Net::FTP->new("some.host.name", Debug => 0);
-    $ftp->login("anonymous",'-anonymous@');
-    $ftp->cwd("/pub");
-    $ftp->get("that.file");
+    $ftp = Net::FTP->new("some.host.name", Debug => 0)
+      or die "Cannot connect to some.host.name: $@";
+
+    $ftp->login("anonymous",'-anonymous@')
+      or die "Cannot login ", $ftp->message;
+
+    $ftp->cwd("/pub")
+      or die "Cannot change working directory ", $ftp->message;
+
+    $ftp->get("that.file")
+      or die "get failed ", $ftp->message;
+
     $ftp->quit;
 
 =head1 DESCRIPTION
@@ -1721,6 +1729,6 @@ under the same terms as Perl itself.
 
 =for html <hr>
 
-I<$Id: //depot/libnet/Net/FTP.pm#71 $>
+I<$Id: //depot/libnet/Net/FTP.pm#72 $>
 
 =cut