r22859 - in /branches/upstream/libnet-scp-expect-perl/current: CHANGES Expect.pm MANIFEST META.yml Makefile.PL README SIGNATURE t/attributes.t t/signature.t

gregoa at users.alioth.debian.org gregoa at users.alioth.debian.org
Sun Jul 6 12:40:13 UTC 2008


Author: gregoa
Date: Sun Jul  6 12:40:12 2008
New Revision: 22859

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=22859
Log:
[svn-upgrade] Integrating new upstream version, libnet-scp-expect-perl (0.13)

Added:
    branches/upstream/libnet-scp-expect-perl/current/META.yml
    branches/upstream/libnet-scp-expect-perl/current/SIGNATURE
    branches/upstream/libnet-scp-expect-perl/current/t/signature.t
Modified:
    branches/upstream/libnet-scp-expect-perl/current/CHANGES
    branches/upstream/libnet-scp-expect-perl/current/Expect.pm
    branches/upstream/libnet-scp-expect-perl/current/MANIFEST
    branches/upstream/libnet-scp-expect-perl/current/Makefile.PL
    branches/upstream/libnet-scp-expect-perl/current/README
    branches/upstream/libnet-scp-expect-perl/current/t/attributes.t

Modified: branches/upstream/libnet-scp-expect-perl/current/CHANGES
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-scp-expect-perl/current/CHANGES?rev=22859&op=diff
==============================================================================
--- branches/upstream/libnet-scp-expect-perl/current/CHANGES (original)
+++ branches/upstream/libnet-scp-expect-perl/current/CHANGES Sun Jul  6 12:40:12 2008
@@ -1,4 +1,34 @@
 Revision history for Perl extension Net-SCP-Expect
+
+0.13  Wednesday June 11 05:07:34 2008
+- Corrected issue with no exception thrown on failed scp execution after
+successful login.  In general, exception handling should be more robust
+and behave more consistently now.
+
+- If an error_handler is defined, will now immediately return void from a
+scp() call after the handler has executed.
+
+- Fixed RT#18077 (error_handler not handing timeouts properly). Also added
+immediate return from scp function if customer handler used, as no further
+actions may be taken.
+
+- Fixed RT#22907 (Some options require trailing space).
+
+- Fixed RT#22909 (scp command string is underquoted). Use option 'auto_quote'
+to enable auto-quote scp arguments.  Also escapes other single quotes to
+insure support for path names with single quotes.  NOTE: This option is
+enabled by default, which may break for backward compatibility with scripts
+that manually quoted input arguments as a work-around for this bug.
+
+- Fixed RT#24273 (scp binary is hardcoded, cannot specify a different path to
+scp).  Use option 'scp_path' to specify a different SCP binary.
+
+- Fixed RT#34001 (exit value is automatically set to -1 (255) when a program
+including threads uses 'Net::SCP::Expect' - this breaks Test::*).  Removed
+CHLD signal handler, instead relying on Expect to manage process exit cleanup.
+
+- Fixed RT#34503 (Destination can't contain colon ':').
+
 0.12  Wednesday Nov 24 08:03:33 2004
 - Dumb bug fix.
 

Modified: branches/upstream/libnet-scp-expect-perl/current/Expect.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-scp-expect-perl/current/Expect.pm?rev=22859&op=diff
==============================================================================
--- branches/upstream/libnet-scp-expect-perl/current/Expect.pm (original)
+++ branches/upstream/libnet-scp-expect-perl/current/Expect.pm Sun Jul  6 12:40:12 2008
@@ -8,16 +8,13 @@
 package Net::SCP::Expect;
 use strict;
 use Expect;
-use POSIX qw(:signal_h WNOHANG);
 use File::Basename;
 use Carp;
 use Cwd;
 
-$SIG{CHLD} = \&reapChild;
-
 BEGIN{
    use vars qw/$VERSION/;
-   $VERSION = '.12';
+   $VERSION = '0.13';
 }
 
 # Options added as needed
@@ -44,6 +41,8 @@
       _identity_file => $arg{identity_file} || undef,
       _option        => $arg{option} || undef,
       _subsystem     => $arg{subsystem} || undef,
+      _scp_path      => $arg{scp_path} || undef,
+      _auto_quote    => $arg{auto_quote} || 1,
    };
 
    bless($self,$class);
@@ -128,6 +127,8 @@
    my $identity_file = $self->_get('identity_file');
    my $option        = $self->_get('option');
    my $subsystem     = $self->_get('subsystem');
+   my $scp_path      = $self->_get('scp_path');
+   my $auto_quote    = $self->_get('auto_quote');
  
    ##################################################################
    # If the second argument is not provided, the remote file will be
@@ -155,26 +156,43 @@
    croak("No password. Can't scp") unless $password;
    croak("No host specified. Can't scp") unless $host;
 
+   # Define argument auto-quote
+   my $qt = $auto_quote ? '\'' : '';
+
    # Gather flags.
    my $flags;
 
-   $flags .= "-c $cipher " if $cipher;
-   $flags .= "-P $port " if $port;
+   $flags .= "-c $qt$cipher$qt " if $cipher;
+   $flags .= "-P $qt$port$qt " if $port;
    $flags .= "-r " if $recursive;
    $flags .= "-v " if $verbose;
    $flags .= "-p " if $preserve;
-   $flags .= "-$protocol " if $protocol;
+   $flags .= "-$qt$protocol$qt " if $protocol;
    $flags .= "-q ";  # Always pass this option (no progress meter)
-   $flags .= "-s $subsystem" if $subsystem;
-   $flags .= "-o $option" if $option;
-   $flags .= "-i $identity_file" if $identity_file;
+   $flags .= "-s $qt$subsystem$qt " if $subsystem;
+   $flags .= "-o $qt$option$qt " if $option;
+   $flags .= "-i $qt$identity_file$qt " if $identity_file;
 
    my $scp = Expect->new;
    #if($verbose){ $scp->raw_pty(1) }
    #$scp->debug(1);
 
-   my $scp_string = "scp $flags $from $to";
-   $scp = Expect->spawn($scp_string) or croak "Couldn't start program: $!\n";
+   # Use scp specified by the user, if possible
+   $scp_path = defined $scp_path ? "$qt$scp_path$qt" : "scp ";
+
+   # Escape quotes
+   if ($auto_quote) {
+      $from =~ s/'/'"'"'/go;
+      $to =~ s/'/'"'"'/go;
+   }
+
+   my $scp_string = "$scp_path $flags $qt$from$qt $qt$to$qt";
+   $scp = Expect->spawn($scp_string);
+   
+   unless ($scp) {
+      if($handler){ $handler->($!); return; }
+      else { croak("Couldn't start program: $!"); }
+   }
 
    $scp->log_stdout(0);
 
@@ -187,10 +205,12 @@
    unless($scp->expect($timeout,-re=>'[Pp]assword.*?:|[Pp]assphrase.*?:')){
       my $err = $scp->before() || $scp->match();
       if($err){
-         if($handler){ $handler->($err) }
-         croak("Problem performing scp: $err");
+         if($handler){ $handler->($err); return; }
+         else { croak("Problem performing scp: $err"); }
       }
-      croak("scp timed out while trying to connect to $host");
+      $err = "scp timed out while trying to connect to $host";
+      if($handler){ $handler->($err); return; }
+      else{ croak($err) };
    }
 
    if($verbose){ print $scp->before() }
@@ -207,13 +227,16 @@
    # The exception to this is verbose output, which can mistakenly
    # be picked up by Expect.
    ################################################################
+   my $error;
+   my $eof = 0;
    unless($no_check || $verbose){
 
-      $scp->expect($timeout_err,
+      $error = ($scp->expect($timeout_err,
          [qr/[Pp]ass.*/ => sub{
                my $error = $scp->before() || $scp->match();
                if($handler){
                   $handler->($error);
+                  return;
                }
                else{
                   croak("Error: Bad password [$error]");
@@ -224,22 +247,46 @@
                my $error = $scp->match() || $scp->before();
                if($handler){
                   $handler->($error);
+                  return;
                }
                else{
-                  croak("Error - last line returned was: $error");
+                  croak("Error: last line returned was: $error");
                }
             }
          ],
-         ['eof' => sub{} ],
-      );
+         ['eof' => sub{ $eof = 1 } ],
+      ))[1];
    }
    else{
-      $scp->expect($timeout_err, ['eof' => sub { }]);
+      $error = ($scp->expect($timeout_err, ['eof' => sub { $eof = 1 }]))[1];
    }
 
    if($verbose){ print $scp->after(),"\n" }
 
+   # Ignore error if it was due to scp auto-exiting successfully (which may trigger false positives on some platforms)
+   if ($error && !($eof && $error =~ m/^(2|3)/o)) {
+      if ($handler) {
+         $handler->($error);
+         return;
+      }
+      else {
+         croak("scp processing error occured: $error");
+      }
+   }
+   
+   # Insure we check exit state of process
    $scp->hard_close();
+
+   if ($scp->exitstatus > 0) {   #ignore -1, in case there's a waitpid portability issue
+      if ($handler) {
+         $handler->($scp->exitstatus);
+         return;
+      }
+      else {
+         croak("scp exited with non-success state: " . $scp->exitstatus);
+      }
+   }
+
    return 1;
 }
 
@@ -249,7 +296,7 @@
    my @parts;
    my($user,$host,$dest);
 
-   @parts = split(/@/,$string);
+   @parts = split(/@/,$string,2);
    if(scalar(@parts) == 2){
       $user = shift(@parts);
    }
@@ -258,7 +305,7 @@
    }
 
    my $temp = join('', at parts);
-   ($host,$dest) = split(/:/,$temp);
+   ($host,$dest) = split(/:/,$temp,2);
 
    # scp('file','file') syntax, where local to remote is assumed
    unless($dest){
@@ -269,10 +316,6 @@
    $host ||= $self->_get("host");
    return ($user,$host,$dest);
 }
-
-sub reapChild{
-   do {} while waitpid(-1,WNOHANG) > 0;
-}
 1;
 __END__
 
@@ -284,28 +327,19 @@
 
 B<Example 1 - uses login method, longhand scp:>
 
-C<< my $scpe = Net::SCP::Expect->new; >>
-
-C<< $scpe->login('user name', 'password'); >>
-
-C<< $scpe->scp('file','host:/some/dir'); >>
-
-
+ my $scpe = Net::SCP::Expect->new;
+ $scpe->login('user name', 'password');
+ $scpe->scp('file','host:/some/dir');
 
 B<Example 2 - uses constructor, shorthand scp:>
 
-C<< my $scpe = Net::SCP::Expect->new(host=>'host', user=>'user', password=>'xxxx'); >>
-
-C<< $scpe->scp('file','/some/dir'); # 'file' copied to 'host' at '/some/dir' >>
-
-
-
-B<Example 3 - Copying from remote machine to local host>
-
-C<< my $scpe = Net::SCP::Expect->new(user=>'user',password=>'xxxx'); >>
-
-C<< $scpe->scp('host:/some/dir/filename','newfilename'); >>
-
+ my $scpe = Net::SCP::Expect->new(host=>'host', user=>'user', password=>'xxxx');
+ $scpe->scp('file','/some/dir'); # 'file' copied to 'host' at '/some/dir'
+
+B<Example 3 - copying from remote machine to local host>
+
+ my $scpe = Net::SCP::Expect->new(user=>'user',password=>'xxxx');
+ $scpe->scp('host:/some/dir/filename','newfilename');
 
 See the B<scp()> method for more information on valid syntax.
 
@@ -324,79 +358,88 @@
 
 =head1 USAGE
 
-B<Net::SCP::Expect-E<gt>new(>I<option=E<gt>val>,...B<)>
-
-Creates a new object and optionally takes a series of options (see OPTIONS below).
-
-=head2 METHODS
+=head2 B<Net::SCP::Expect-E<gt>new(>I<option=E<gt>val>, ...B<)>
+
+Creates a new object and optionally takes a series of options (see L<"OPTIONS"> below).
+All L<"OBJECT METHODS"> apply to this constructor.
+
+=head1 OBJECT METHODS
+
+=head2 B<auto_yes>
+
+Set this to 1 if you want to automatically pass a 'yes' string to
+any yes or no questions that you may encounter before actually being asked for
+a password, e.g. "Are you sure you want to continue connecting (yes/no)?" for
+first time connections, etc.
+
+=head2 B<error_handler(>I<sub ref>B<)>
+
+This sets up an error handler to catch any problems with a call to 'scp()'.  If you
+do not define an error handler, then a simple 'croak()' call will occur, with the last
+line sent to the terminal added as part of the error message.
+
+The method will immediately return with a void value after your error handler has been
+called.
+
+=head2 B<host(>I<host>B<)>
+
+Sets the host for the current object
+
+=head2 B<login(>I<login, password>B<)>
+
+If the login and password are not passed as options to the constructor, they
+must be passed with this method (or set individually - see 'user' and 'password'
+methods).  If they were already set, this method will overwrite them with the new
+values.
+
+=head2 B<password(>I<password>B<)>
+
+Sets the password for the current user
+
+=head2 B<user(>I<user>B<)>
+
+Sets the user for the current object
+
+=head2 B<scp()>
+
+Copies the file from source to destination.  If no host is specified, you
+will be using 'scp' as an expensive form of 'cp'.
+
+There are several valid ways to use this method
+
+=head3 Local to Remote
+
+B<scp(>I<source, user at host:destination>B<);>
+
+B<scp(>I<source, host:destination>B<);> # User already defined
+
+B<scp(>I<source, :destination>B<);> # User and host already defined
+
+B<scp(>I<source, destination>B<);> # Same as previous
+
+=head3 Remote to Local
+
+B<scp(>I<user at host:source, destination>B<);>
+
+B<scp(>I<host:source, destination>B<);>
+
+B<scp(>I<:source, destination>B<);>
+
+=head1 OPTIONS
+
+B<auto_quote> - Auto-encapsulate all option values and scp from/to arguments in
+single-quotes to insure that special characters, such as spaces in file names,
+do not cause inadvertant shell exceptions.  Default is enabled.
+Note: Be aware that this feature may break backward compatibility with scripts
+that manually quoted input arguments to work around unquoted argument limitations
+in 0.12 or earlier of this module; in such cases, try disabling it or update
+your script to take advantage of the auto_quote feature.
 
 B<auto_yes> - Set this to 1 if you want to automatically pass a 'yes' string to
 any yes or no questions that you may encounter before actually being asked for
 a password, e.g. "Are you sure you want to continue connecting (yes/no)?" for
 first time connections, etc.
 
-B<error_handler(>I<sub ref>B<)>
-
-This sets up an error handler to catch any problems with a call to 'scp()'.  If you
-do not define an error handler, then a simple 'croak()' call will occur, with the last
-line sent to the terminal added as part of the error message.
-
-I highly recommend you forcibly terminate your program somehow within your handler
-(via die, croak, exit, etc), otherwise your program may hang, as it sits there waiting
-for terminal input.
-
-B<host(>I<host>B<)>
-
-Sets the host for the current object
-
-B<login(>I<login,password>B<)>
-
-If the login and password are not passed as options to the constructor, they
-must be passed with this method (or set individually - see 'user' and 'password'
-methods).  If they were already set, this method will overwrite them with the new
-values.
-
-B<password(>I<password>B<)>
-
-Sets the password for the current user
-
-B<user(>I<user>B<)>
-
-Sets the user for the current object
-
-B<scp()>
-
-Copies the file from source to destination.  If no host is specified, you
-will be using 'scp' as an expensive form of 'cp'.
-
-There are several valid ways to use this method
-
-B<LOCAL TO REMOTE>
-
-B<scp(>I<source, user at host:destination>B<);>
-
-B<scp(>I<source, host:destination>B<);> # User already defined
-
-B<scp(>I<source, :destination>B<);> # User and host already defined
-
-B<scp(>I<source, destination>B<);> # Same as previous
-
-B<REMOTE TO LOCAL>
-
-B<scp(>I<user at host:source, destination>B<);>
-
-B<scp(>I<host:source, destination>B<);>
-
-B<scp(>I<:source, destination>B<);>
-
-
-=head1 OPTIONS
-
-B<auto_yes> - Set this to 1 if you want to automatically pass a 'yes' string to
-any yes or no questions that you may encounter before actually being asked for
-a password, e.g. "Are you sure you want to continue connecting (yes/no)?" for
-first time connections, etc.
-
 B<cipher> - Selects the cipher to use for encrypting the data transfer.
 
 B<host> - Specify the host name.  This is now useful for both local-to-remote
@@ -422,6 +465,9 @@
 which simply means scp will use whatever it normally would use.
 
 B<recursive> - Set to 1 if you want to recursively copy entire directories.
+
+B<scp_path> - The path for the scp binary to use, i.e.: /usr/bin/scp, defaults
+to use the first scp on your $PATH variable.
 
 B<subsystem> - Specify a subsystem to invoke on the remote system.  This
 option is only valid with ssh2 and openssh afaik.
@@ -472,32 +518,43 @@
 There are a few options I haven't implemented.  If you *really* want to
 see them added, let me know and I'll see what I can do.
 
-=head1 KNOWN BUGS
+Add exception handling tests to the interactive test suite.
+
+=head1 KNOWN ISSUES
 
 At least one user has reported warnings related to POD parsing with Perl 5.00503.
 These can be safely ignored.  They do not appear in Perl 5.6 or later.
 
 Probably not thread safe. See RT bug #7567 from Adam Ruck.
 
-See the README file for more on possible bugs you may encounter.
-
 =head1 THANKS
 
 Thanks to Roland Giersig (and Austin Schutz) for the Expect module.  Very handy.
 
 Thanks also go out to all those who have submitted bug reports and/or patches.
-See the Changes file for specifics.
+See the CHANGES file for specifics.
 
 =head1 LICENSE
+
 Net::SCP::Expect is licensed under the same terms as Perl itself.
 
 =head1 COPYRIGHT
-(C) 2003, 2004 Daniel J. Berger, All Rights Reserved
-
-=head1 AUTHOR
+
+2005-2007 Eric Rybski <rybskej at yahoo.com>,
+2003-2004 Daniel J. Berger.
+
+=head1 CURRENT AUTHOR AND MAINTAINER
+
+Eric Rybski <rybskej at yahoo.com>.  Please send all module inquries to me.
+
+=head1 ORIGINAL AUTHOR
 
 Daniel Berger
 
 djberg96 at yahoo dot com
 
 imperator on IRC
+
+=head1 SEE ALSO
+
+L<Net::SCP>, L<Net::SFTP>, L<Net::SSH::Perl>, L<Net::SSH2>

Modified: branches/upstream/libnet-scp-expect-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-scp-expect-perl/current/MANIFEST?rev=22859&op=diff
==============================================================================
--- branches/upstream/libnet-scp-expect-perl/current/MANIFEST (original)
+++ branches/upstream/libnet-scp-expect-perl/current/MANIFEST Sun Jul  6 12:40:12 2008
@@ -1,10 +1,13 @@
 CHANGES
 Makefile.PL
 MANIFEST
+META.yml
 README
+SIGNATURE
 Expect.pm
 t/attributes.t
 t/glob.t
+t/signature.t
 t/string_parse.t
 itest/README
 itest/itest.pl

Added: branches/upstream/libnet-scp-expect-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-scp-expect-perl/current/META.yml?rev=22859&op=file
==============================================================================
--- branches/upstream/libnet-scp-expect-perl/current/META.yml (added)
+++ branches/upstream/libnet-scp-expect-perl/current/META.yml Sun Jul  6 12:40:12 2008
@@ -1,0 +1,15 @@
+--- #YAML:1.0
+name:                Net-SCP-Expect
+version:             0.13
+abstract:            Wrapper for scp that allows passwords via Expect.
+license:             ~
+author:              
+    - Eric Rybski <rybskej at yahoo.com>
+generated_by:        ExtUtils::MakeMaker version 6.44
+distribution_type:   module
+requires:     
+    Expect:                        1.14
+    Term::ReadPassword:            0.01
+meta-spec:
+    url:     http://module-build.sourceforge.net/META-spec-v1.3.html
+    version: 1.3

Modified: branches/upstream/libnet-scp-expect-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-scp-expect-perl/current/Makefile.PL?rev=22859&op=diff
==============================================================================
--- branches/upstream/libnet-scp-expect-perl/current/Makefile.PL (original)
+++ branches/upstream/libnet-scp-expect-perl/current/Makefile.PL Sun Jul  6 12:40:12 2008
@@ -2,10 +2,10 @@
 # See lib/ExtUtils/MakeMaker.pm for details of how to influence
 # the contents of the Makefile that is written.
 WriteMakefile(
-    'NAME'		=> 'Net::SCP::Expect',
-    'VERSION_FROM'	=> 'Expect.pm', # finds $VERSION
-    'PREREQ_PM'		=> {'Expect' => '1.14','Term::ReadPassword' => '0.01'},
+    'NAME'          => 'Net::SCP::Expect',
+    'VERSION_FROM'  => 'Expect.pm', # finds $VERSION
+    'PREREQ_PM'     => {'Expect' => '1.14','Term::ReadPassword' => '0.01'},
     ($] >= 5.005 ?    ## Add these new keywords supported since 5.005
       (ABSTRACT_FROM => 'Expect.pm', # retrieve abstract from module
-       AUTHOR     => 'Daniel Berger <djberg96 at hotmail.com>') : ()),
+       AUTHOR        => 'Eric Rybski <rybskej at yahoo.com>') : ()),
 );

Modified: branches/upstream/libnet-scp-expect-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-scp-expect-perl/current/README?rev=22859&op=diff
==============================================================================
--- branches/upstream/libnet-scp-expect-perl/current/README (original)
+++ branches/upstream/libnet-scp-expect-perl/current/README Sun Jul  6 12:40:12 2008
@@ -4,35 +4,28 @@
 SYNOPSIS
     Example 1 - uses login method, longhand scp:
 
-    "my $scpe = Net::SCP::Expect->new;"
-
-    "$scpe->login('user name', 'password');"
-
-    "$scpe->scp('file','host:/some/dir');"
-
-    .
+     my $scpe = Net::SCP::Expect->new;
+     $scpe->login('user name', 'password');
+     $scpe->scp('file','host:/some/dir');
 
     Example 2 - uses constructor, shorthand scp:
 
-    "my $scpe = Net::SCP::Expect->new(host=>'host', user=>'user',
-    password=>'xxxx');"
-
-    "$scpe->scp('file','/some/dir'); # 'file' copied to 'host' at
-    '/some/dir'"
-
-    .
-
-    Example 3 - Copying from remote machine to local host
-
-    "my $scpe = Net::SCP::Expect->new(user=>'user',password=>'xxxx');"
-
-    "$scpe->scp('host:/some/dir/filename','newfilename');"
+     my $scpe = Net::SCP::Expect->new(host=>'host', user=>'user', password=>'xxxx');
+     $scpe->scp('file','/some/dir'); # 'file' copied to 'host' at '/some/dir'
+
+    Example 3 - copying from remote machine to local host
+
+     my $scpe = Net::SCP::Expect->new(user=>'user',password=>'xxxx');
+     $scpe->scp('host:/some/dir/filename','newfilename');
 
     See the scp() method for more information on valid syntax.
 
 PREREQUISITES
     Expect 1.14. May work with earlier versions, but was tested with 1.14
     (and now 1.15) only.
+
+    Term::ReadPassword 0.01 is required if you want to execute the
+    interactive test script.
 
 DESCRIPTION
     This module is simply a wrapper around the scp call. The primary
@@ -41,79 +34,78 @@
     interactive sessions.
 
 USAGE
-    Net::SCP::Expect->new(*option=>val*,...)
-
+  Net::SCP::Expect->new(*option=>val*, ...)
     Creates a new object and optionally takes a series of options (see
-    OPTIONS below).
-
-  METHODS
+    "OPTIONS" below). All "OBJECT METHODS" apply to this constructor.
+
+OBJECT METHODS
+  auto_yes
+    Set this to 1 if you want to automatically pass a 'yes' string to any
+    yes or no questions that you may encounter before actually being asked
+    for a password, e.g. "Are you sure you want to continue connecting
+    (yes/no)?" for first time connections, etc.
+
+  error_handler(*sub ref*)
+    This sets up an error handler to catch any problems with a call to
+    'scp()'. If you do not define an error handler, then a simple 'croak()'
+    call will occur, with the last line sent to the terminal added as part
+    of the error message.
+
+    The method will immediately return with a void value after your error
+    handler has been called.
+
+  host(*host*)
+    Sets the host for the current object
+
+  login(*login, password*)
+    If the login and password are not passed as options to the constructor,
+    they must be passed with this method (or set individually - see 'user'
+    and 'password' methods). If they were already set, this method will
+    overwrite them with the new values.
+
+  password(*password*)
+    Sets the password for the current user
+
+  user(*user*)
+    Sets the user for the current object
+
+  scp()
+    Copies the file from source to destination. If no host is specified, you
+    will be using 'scp' as an expensive form of 'cp'.
+
+    There are several valid ways to use this method
+
+   Local to Remote
+    scp(*source, user at host:destination*);
+
+    scp(*source, host:destination*); # User already defined
+
+    scp(*source, :destination*); # User and host already defined
+
+    scp(*source, destination*); # Same as previous
+
+   Remote to Local
+    scp(*user at host:source, destination*);
+
+    scp(*host:source, destination*);
+
+    scp(*:source, destination*);
+
+OPTIONS
+    auto_quote - Auto-encapsulate all option values and scp from/to
+    arguments in single-quotes to insure that special characters, such as
+    spaces in file names, do not cause inadvertant shell exceptions. Default
+    is enabled. Note: Be aware that this feature may break backward
+    compatibility with scripts that manually quoted input arguments to work
+    around unquoted argument limitations in 0.12 or earlier of this module;
+    in such cases, try disabling it or update your script to take advantage
+    of the auto_quote feature.
 
     auto_yes - Set this to 1 if you want to automatically pass a 'yes'
     string to any yes or no questions that you may encounter before actually
     being asked for a password, e.g. "Are you sure you want to continue
     connecting (yes/no)?" for first time connections, etc.
 
-    error_handler(*sub ref*)
-
-    This sets up an error handler to catch any problems with a call to
-    'scp()'. If you do not define an error handler, then a simple 'croak()'
-    call will occur, with the last line sent to the terminal added as part
-    of the error message.
-
-    I highly recommend you forcibly terminate your program somehow within
-    your handler (via die, croak, exit, etc), otherwise your program may
-    hang, as it sits there waiting for terminal input.
-
-    host(*host*)
-
-    Sets the host for the current object
-
-    login(*login,password*)
-
-    If the login and password are not passed as options to the constructor,
-    they must be passed with this method (or set individually - see 'user'
-    and 'password' methods). If they were already set, this method will
-    overwrite them with the new values.
-
-    password(*password*)
-
-    Sets the password for the current user
-
-    user(*user*)
-
-    Sets the user for the current object
-
-    scp()
-
-    Copies the file from source to destination. If no host is specified, you
-    will be using 'scp' as an expensive form of 'cp'.
-
-    There are several valid ways to use this method
-
-    LOCAL TO REMOTE
-
-    scp(*source, user at host:destination*);
-
-    scp(*source, host:destination*); # User already defined
-
-    scp(*source, :destination*); # User and host already defined
-
-    scp(*source, destination*); # Same as previous
-
-    REMOTE TO LOCAL
-
-    scp(*user at host:source, destination*);
-
-    scp(*host:source, destination*);
-
-    scp(*:source, destination*);
-
-OPTIONS
-    auto_yes - Set this to 1 if you want to automatically pass a 'yes'
-    string to any yes or no questions that you may encounter before actually
-    being asked for a password, e.g. "Are you sure you want to continue
-    connecting (yes/no)?" for first time connections, etc.
-
     cipher - Selects the cipher to use for encrypting the data transfer.
 
     host - Specify the host name. This is now useful for both
@@ -126,8 +118,8 @@
     you want to speed up your scp calls - up to 2 seconds per call (based on
     the defaults).
 
-    option - Specify options from the config file.  This is the equivalent
-    of -o.
+    option - Specify options from the config file. This is the equivalent of
+    -o.
 
     password - The password for the given login.
 
@@ -136,13 +128,19 @@
     preserve - Preserves modification times, access times, and modes from
     the original file.
 
+    protocol - Specify the ssh protocol to use for scp. The default is
+    undef, which simply means scp will use whatever it normally would use.
+
     recursive - Set to 1 if you want to recursively copy entire directories.
 
-    subsystem - Specify a subsystem to invoke on the remote system.  This
+    scp_path - The path for the scp binary to use, i.e.: /usr/bin/scp,
+    defaults to use the first scp on your $PATH variable.
+
+    subsystem - Specify a subsystem to invoke on the remote system. This
     option is only valid with ssh2 and openssh afaik.
 
-    terminator - Set the string terminator that is attached to the end of the
-    password.  The default is a newline.
+    terminator - Set the string terminator that is attached to the end of
+    the password. The default is a newline.
 
     timeout - Sets the timeout value for your scp operation. The default is
     10 seconds.
@@ -156,11 +154,17 @@
     timeout_err - Sets the timeout for the additional error checking that
     the module does. Because errors come back almost instantaneously, I
     thought it best to make this a separate option for the same reasons as
-    the 'timeout_auto' option above. The default is 1 second.
+    the 'timeout_auto' option above. The default is 'undef'.
+
+    Setting it to any integer value means that your program will exit after
+    that many seconds *whether or not the operation has completed*. Caveat
+    programmor.
 
     user - The login name you wish to use.
 
-    verbose - Set to 1 if you want verbose output sent to STDOUT.
+    verbose - Set to 1 if you want verbose output sent to STDOUT. Note that
+    this disables some error checking (ala no_check) because the verbose
+    output could otherwise be picked up by expect itself.
 
 NOTES
     The -q option (disable progress meter) is automatically passed to scp.
@@ -168,45 +172,51 @@
     The -B option may NOT be set. If you don't want to send passwords, I
     recommend using *Net::SCP* instead.
 
-    In the event that Dave Rolsky releases a version of *Net::SSH::Perl* that
-    supports scp, I recommend using that instead. Why? First, it will be a
-    more secure way to perform scp. Second, this module is not fast, even
-    with error checking turned off. Both reasons have to do with TTY
+    In the event that Dave Rolsky releases a version of *Net::SSH::Perl*
+    that supports scp, I recommend using that instead. Why? First, it will
+    be a more secure way to perform scp. Second, this module is not fast,
+    even with error checking turned off. Both reasons have to do with TTY
     interaction.
 
-    Also see Net::SFTP by Dave Rolsky.  If that module suits your needs,
-    use it instead.
-
-    Don't whine to me about putting passwords in scripts. Set your
-    permissions appropriately or use a .rc file of some kind.
+    Also, please see the Net::SFTP module from Dave Rolsky. If this suits
+    your needs, use it instead.
 
 FUTURE PLANS
     There are a few options I haven't implemented. If you *really* want to
     see them added, let me know and I'll see what I can do.
 
-KNOWN BUGS
+    Add exception handling tests to the interactive test suite.
+
+KNOWN ISSUES
     At least one user has reported warnings related to POD parsing with Perl
     5.00503. These can be safely ignored. They do not appear in Perl 5.6 or
     later.
 
-    I have one unconfirmed report of problems with wildcard characters. I
-    haven't had a chance to test this yet.
-
-    Probably not thread safe.  See RT bug #7567 by Adam Ruck.
+    Probably not thread safe. See RT bug #7567 from Adam Ruck.
 
 THANKS
     Thanks to Roland Giersig (and Austin Schutz) for the Expect module. Very
     handy.
 
+    Thanks also go out to all those who have submitted bug reports and/or
+    patches. See the CHANGES file for specifics.
+
 LICENSE
-    Net::SCP::Expect is licensed under the same terms as Perl itself
+    Net::SCP::Expect is licensed under the same terms as Perl itself.
 
 COPYRIGHT
-    (C) 2003, 2004 Daniel J. Berger, All Rights Reserved
-
-AUTHOR
+    2005-2007 Eric Rybski <rybskej at yahoo.com>, 2003-2004 Daniel J. Berger.
+
+CURRENT AUTHOR AND MAINTAINER
+    Eric Rybski <rybskej at yahoo.com>. Please send all module inquries to me.
+
+ORIGINAL AUTHOR
     Daniel Berger
 
     djberg96 at yahoo dot com
 
     imperator on IRC
+
+SEE ALSO
+    Net::SCP, Net::SFTP, Net::SSH::Perl, Net::SSH2
+

Added: branches/upstream/libnet-scp-expect-perl/current/SIGNATURE
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-scp-expect-perl/current/SIGNATURE?rev=22859&op=file
==============================================================================
--- branches/upstream/libnet-scp-expect-perl/current/SIGNATURE (added)
+++ branches/upstream/libnet-scp-expect-perl/current/SIGNATURE Sun Jul  6 12:40:12 2008
@@ -1,0 +1,40 @@
+This file contains message digests of all files listed in MANIFEST,
+signed via the Module::Signature module, version 0.55.
+
+To verify the content in this distribution, first make sure you have
+Module::Signature installed, then type:
+
+    % cpansign -v
+
+It will check each file's integrity, as well as the signature's
+validity.  If "==> Signature verified OK! <==" is not displayed,
+the distribution may already have been compromised, and you should
+not run its Makefile.PL or Build.PL.
+
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA1
+
+SHA1 d658ac2b75471816b5ee4a98bacf3c4cf0b9cd34 CHANGES
+SHA1 ccbe643107cc6f7efe0de8d9c842d7c8ff5ec4a4 Expect.pm
+SHA1 8204b60b11c8c8d5dc52acb69f028bcb87a61e55 MANIFEST
+SHA1 932fe19a883d27e31c6448efefd7f424eec5423f META.yml
+SHA1 c80c11b8e2dbc549e3deffedc51a5a3b682e7620 Makefile.PL
+SHA1 9587204874f99cf54a64dc3a27f3feeb5f7c9961 README
+SHA1 f45399354c8baa415a0326a96ffb55ba8f9d373d itest/README
+SHA1 5bd412641e16ca53c0b3bc26cc605cf733c7583f itest/itest.pl
+SHA1 b406d2f6219fd2a06ee1735e3d115803aff891fd itest/large_file.test
+SHA1 6e1f28ab6c9db1c2cc4ef8a24032283550681947 itest/medium_file.test
+SHA1 93c4513b18e1d13c0fa3c7f9ed8bb289337092fb itest/small_file.test
+SHA1 93c4513b18e1d13c0fa3c7f9ed8bb289337092fb itest/small_file2.test
+SHA1 93c4513b18e1d13c0fa3c7f9ed8bb289337092fb itest/small_file3.test
+SHA1 b122277eecc762cc97f9bdf07a50d7a5bed2c2cf t/attributes.t
+SHA1 bb08d81fb36c76b010d274b3f1f34e8da5dd5fc9 t/glob.t
+SHA1 fc5734f9c393dcc9f12c87df4bf9362e88a800ad t/signature.t
+SHA1 d252b20bd1904ae699e0efd4386ed1a166e9415f t/string_parse.t
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1.4.8 (Darwin)
+
+iEYEARECAAYFAkhPoB8ACgkQQwn7DcpJEO5hKQCgySrWSrZKxoj+ZCJ++QZIOqM5
+3oEAnjK2BNWyhjnx8SGGewYuvdf8/NWL
+=HEjC
+-----END PGP SIGNATURE-----

Modified: branches/upstream/libnet-scp-expect-perl/current/t/attributes.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-scp-expect-perl/current/t/attributes.t?rev=22859&op=diff
==============================================================================
--- branches/upstream/libnet-scp-expect-perl/current/t/attributes.t (original)
+++ branches/upstream/libnet-scp-expect-perl/current/t/attributes.t Sun Jul  6 12:40:12 2008
@@ -1,5 +1,5 @@
 use strict;
-use Test::More tests => 20;
+use Test::More tests => 22;
 
 BEGIN{ use_ok('Net::SCP::Expect') }
 
@@ -28,3 +28,5 @@
 is(undef,$scp->_get("subsystem"),"subsystem attribute");
 is(undef,$scp->_get("option"),"option attribute");
 is(undef,$scp->_get("identity_file"),"identity_file attribute");
+is(1,$scp->_get("auto_quote"),"auto_quote attribute");
+is(undef,$scp->_get("scp_path"),"scp_path attribute");

Added: branches/upstream/libnet-scp-expect-perl/current/t/signature.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-scp-expect-perl/current/t/signature.t?rev=22859&op=file
==============================================================================
--- branches/upstream/libnet-scp-expect-perl/current/t/signature.t (added)
+++ branches/upstream/libnet-scp-expect-perl/current/t/signature.t Sun Jul  6 12:40:12 2008
@@ -1,0 +1,39 @@
+#!/usr/local/bin/perl -w
+
+use Test::More;
+use strict;
+
+if (!$ENV{TEST_SIGNATURE}) {
+    plan skip_all => 
+      "Set the environment variable TEST_SIGNATURE to enable this test.";
+}
+elsif (!eval { require Module::Signature; 1 }) {
+    plan skip_all => 
+      "Next time around, consider installing Module::Signature, ".
+      "so you can verify the integrity of this distribution.";
+}
+elsif ( !-e 'SIGNATURE' ) {
+    plan skip_all => "SIGNATURE not found";
+}
+elsif ( -s 'SIGNATURE' == 0 ) {
+    plan skip_all => "SIGNATURE file empty";
+}
+elsif (!eval { require Socket; Socket::inet_aton('pgp.mit.edu') }) {
+    plan skip_all => "Cannot connect to the keyserver to check module ".
+                     "signature";
+}
+else {
+    plan tests => 1;
+}
+
+my $ret = Module::Signature::verify();
+SKIP: {
+    skip "Module::Signature cannot verify", 1 
+      if $ret eq Module::Signature::CANNOT_VERIFY();
+
+    cmp_ok $ret, '==', Module::Signature::SIGNATURE_OK(), "Valid signature";
+}
+
+1;
+
+__END__




More information about the Pkg-perl-cvs-commits mailing list