[perltidy] and removed user/password info
authorHeiko Schlittermann <hs@schlittermann.de>
Mon, 28 Dec 2009 22:12:30 +0100
changeset 5 f9e6018b4a54
parent 0 07bc300bc0f5
child 7 6f9037523a38
[perltidy] and removed user/password info
.perltidyrc
ftpipe
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.perltidyrc	Mon Dec 28 22:12:30 2009 +0100
@@ -0,0 +1,2 @@
+--paren-tightness=2
+--square-bracket-tightness=2
--- a/ftpipe	Fri Oct 16 23:23:26 2009 +0200
+++ b/ftpipe	Mon Dec 28 22:12:30 2009 +0100
@@ -7,30 +7,28 @@
 use if $ENV{DEBUG} => qw(Smart::Comments);
 use feature qw(say switch);
 
-# host: backup.ccos.de
-# user: 54117
-# pass: aOUN9I6v
-
-my $opt_put = 0;
-my $opt_get = 0;
+my $opt_put   = 0;
+my $opt_get   = 0;
 my $opt_debug = 0;
-my $opt_cmd = "";
+my $opt_cmd   = "";
 
 sub exec_create(@);
 
-
 sub parse_url($);
 
 MAIN: {
     GetOptions(
-	"p|put!" => sub { $opt_cmd = "put" },
-	"g|get!" => sub { $opt_cmd = "get" },
-	#"l|ls!"  => 
-	#"r|rm!"  => 
-	"debug!" => \$opt_debug,
-	"h|help" => sub { pod2usage(-verbose => 1, -exit => 0) },
-	"m|man" => sub { pod2usage(-verbose => 2, -exit => 0) },
-    ) and @ARGV or pod2usage();
+        "p|put!" => sub { $opt_cmd = "put" },
+        "g|get!" => sub { $opt_cmd = "get" },
+
+        #"l|ls!"  =>
+        #"r|rm!"  =>
+        "debug!" => \$opt_debug,
+        "h|help" => sub { pod2usage(-verbose => 1, -exit => 0) },
+        "m|man"  => sub { pod2usage(-verbose => 2, -exit => 0) },
+      )
+      and @ARGV
+      or pod2usage();
 
     my %ftp = parse_url(shift);
 
@@ -40,16 +38,16 @@
 
     my $ftp = new FTP($ftp{host}, Debug => $opt_debug, Passive => 1);
     $ftp->login($ftp{user}, $ftp{pass});
-    $ftp->cwd($ftp{dir}); 
+    $ftp->cwd($ftp{dir});
 
     given ($opt_cmd) {
-	when("put")  { $ftp->put(*STDIN, $ftp{file}) }
-	when("get")  { $ftp->get($ftp{file}, *STDOUT) }
-	default      { pod2usage }
+        when ("put") { $ftp->put(*STDIN, $ftp{file}) }
+        when ("get") { $ftp->get($ftp{file}, *STDOUT) }
+        default { pod2usage };
     }
 
     exit;
-    
+
     $ftp->put(*STDIN, $ftp{file});
     print $ftp->dir, "\n";
 
@@ -63,38 +61,39 @@
     return my %r = %+;
 }
 
-{ package FTP;
-  use base ("Net::FTP");
+{
+
+    package FTP;
+    use base ("Net::FTP");
 
-  sub new {
-    my $class = shift;
-    my $self = bless $class->SUPER::new(@_)
-	or die $@;
-    return bless $self => $class;
-  }
-
-  sub login {
-    my $self = shift;
-    $self->SUPER::login(@_) or die "Can't login: " . $self->message;
-  }
+    sub new {
+        my $class = shift;
+        my $self  = bless $class->SUPER::new(@_)
+          or die $@;
+        return bless $self => $class;
+    }
 
-  sub cwd {
-    my $self = shift;
-    $self->SUPER::cwd(@_) or die "Can't chdir: " . $self->message;
-  }
+    sub login {
+        my $self = shift;
+        $self->SUPER::login(@_) or die "Can't login: " . $self->message;
+    }
+
+    sub cwd {
+        my $self = shift;
+        $self->SUPER::cwd(@_) or die "Can't chdir: " . $self->message;
+    }
 
-  sub put {
-    my $self = shift;
-    $self->SUPER::put(@_) or die "Can't put: " . $self->message;
-  }
+    sub put {
+        my $self = shift;
+        $self->SUPER::put(@_) or die "Can't put: " . $self->message;
+    }
 
-  sub get {
-    my $self = shift;
-    $self->SUPER::get(@_) or die "Can't put: " . $self->message;
-  }
+    sub get {
+        my $self = shift;
+        $self->SUPER::get(@_) or die "Can't put: " . $self->message;
+    }
 }
 
-
 __END__
 
 =head1 NAME