r19717 - in /branches/upstream/libexpect-simple-perl/current: ChangeLog Changes MANIFEST MANIFEST.SKIP META.yml lib/Expect/Simple.pm
gregoa at users.alioth.debian.org
gregoa at users.alioth.debian.org
Thu May 8 20:04:54 UTC 2008
Author: gregoa
Date: Thu May 8 20:04:53 2008
New Revision: 19717
URL: http://svn.debian.org/wsvn/?sc=1&rev=19717
Log:
[svn-upgrade] Integrating new upstream version, libexpect-simple-perl (0.04)
Added:
branches/upstream/libexpect-simple-perl/current/MANIFEST.SKIP
Modified:
branches/upstream/libexpect-simple-perl/current/ChangeLog
branches/upstream/libexpect-simple-perl/current/Changes
branches/upstream/libexpect-simple-perl/current/MANIFEST
branches/upstream/libexpect-simple-perl/current/META.yml
branches/upstream/libexpect-simple-perl/current/lib/Expect/Simple.pm
Modified: branches/upstream/libexpect-simple-perl/current/ChangeLog
URL: http://svn.debian.org/wsvn/branches/upstream/libexpect-simple-perl/current/ChangeLog?rev=19717&op=diff
==============================================================================
--- branches/upstream/libexpect-simple-perl/current/ChangeLog (original)
+++ branches/upstream/libexpect-simple-perl/current/ChangeLog Thu May 8 20:04:53 2008
@@ -1,57 +1,142 @@
-2007-08-16 Diab Jerius <djerius at cfa.harvard.edu>
+2008-05-06 19:17 -0400 djerius <djerius at cfa.harvard.edu> (e7ce8260d2e9 [tip])
- Tag: 0.03
- * no changes, just release as 0.03
+ * lib/Expect/Simple.pm:
+ don't expose exitstatus routine
+
+2008-05-06 19:14 -0400 djerius <djerius at cfa.harvard.edu> (427807ef1d7e)
+
+ * lib/Expect/Simple.pm:
+ propagate error from failed spawn
+
+2008-05-06 19:12 -0400 djerius <djerius at cfa.harvard.edu> (a05c30ff584e)
+
+ * lib/Expect/Simple.pm:
+ switch internal croaks to dies. clean up exception string new lines
+
+2008-05-06 17:51 -0400 djerius <djerius at cfa.harvard.edu> (385aee63462b)
+
+ * lib/Expect/Simple.pm:
+ no longer attempt to disconnect on failed spawn. don't try to
+ disconnect if the spawned process has already exited.
+
+ the connection object was stashed in the Expect::Simple object
+ before a connection was attempted, leading _disconnect to try and
+ disconnect if the spawn failed when the object was getting
+ automatically destroyed.
+
+2007-08-16 17:30 -0400 djerius <djerius at cfa.harvard.edu> (509bddd42cfd)
+
+ * .hgtags:
+ Added tag 0.03 for changeset 597143fc8e7b
+
+2007-08-16 17:30 -0400 djerius <djerius at cfa.harvard.edu> (597143fc8e7b [0.03])
+
+ * ChangeLog, Changes, MANIFEST, lib/Expect/Simple.pm:
+ update for release
+
+2007-08-16 17:27 -0400 djerius <djerius at cfa.harvard.edu> (762f5212fa09)
+
+ * Makefile.PL:
+ fix typo
+
+2007-08-07 18:07 -0400 djerius <djerius at cfa.harvard.edu> (c783a36b3863)
+
+ * .hgtags:
+ Added tag 0.03_02 for changeset 5fadc78bc572
+
+2007-08-07 18:07 -0400 djerius <djerius at cfa.harvard.edu> (5fadc78bc572 [0.03_02])
+
+ * ChangeLog, Changes:
+ update for release
+
+2007-08-07 18:06 -0400 djerius <djerius at cfa.harvard.edu> (8d96ed7a5297)
+
+ * lib/Expect/Simple.pm:
+ update version for release
2007-08-07 18:05 -0400 djerius <djerius at cfa.harvard.edu> (406422c879e7)
- Tag: 0.03_02
* Makefile.PL:
added LICENSE to Makefile.PL
-2007-07-31 Diab Jerius <djerius at cfa.harvard.edu>
+2007-07-31 18:15 -0400 djerius <djerius at cfa.harvard.edu> (a2d0a3a6de39)
- Tag: 0.03_01
-
+ * .hgtags:
+ Added tag 0.03_01 for changeset 9a57ce45c4e5
-2007-07-31 18:04 -0400 djerius <djerius at cfa.harvard.edu> (d5b8c528e728 [tip])
+2007-07-31 18:15 -0400 djerius <djerius at cfa.harvard.edu> (9a57ce45c4e5 [0.03_01])
+
+ * ChangeLog:
+ update for release
+
+2007-07-31 18:04 -0400 djerius <djerius at cfa.harvard.edu> (d5b8c528e728)
+
* lib/Expect/Simple.pm:
minor code cleanup
2007-07-31 18:00 -0400 djerius <djerius at cfa.harvard.edu> (b3256c687aee)
+ * Changes, lib/Expect/Simple.pm, t/Expect-Simple.t, t/testprog: new
+ file.
+ * GNUmakefile, INSTALL, Simple.pm: deleted file.
* Changes, GNUmakefile, INSTALL, MANIFEST, Makefile.PL, README,
Simple.pm, lib/Expect/Simple.pm, t/Expect-Simple.t, t/testprog:
Modernized layout, new tests, Cmd takes arrays, new RawPty attribute
- Modernized layout
- - Cmd attribute can now take arrays
- [Adriano Ferreira <a.r.ferreira at gmail.com>]
+ - Cmd attribute can now take arrays [Adriano Ferreira
+ <a.r.ferreira at gmail.com>]
- Added RawPty attribute
- tests!
-2007-07-31 13:53 -0400 djerius <djerius at cfa.harvard.edu> (72ff04de2b51 [tip])
- Tag: 0.02
- * belated commit of minor changes for initial release to CPAN
+2007-07-31 13:54 -0400 djerius <djerius at cfa.harvard.edu> (138b0db0cd1d)
+
+ * ChangeLog, MANIFEST, README:
+ update for release
+
+2007-07-31 13:53 -0400 djerius <djerius at cfa.harvard.edu> (72ff04de2b51)
* Simple.pm:
use __PACKAGE__ instad of constant CLASS
-2002-04-12 17:04 tag V0_01
+2007-07-31 17:33 +0000 dj <dj> (43e15f71bf82)
-2002-04-12 17:04 dj
+ * ChangeLog: new file.
+ * ChangeLog:
+ 2007-07-31 17:33:58 by dj added ChangeLog
- * LICENSE, README, Simple.pm: added license info
+2007-07-31 13:34 -0400 djerius <djerius at cfa.harvard.edu> (4c6ebb75d8fe)
-2000-08-31 14:23 tag initial
+ * .hgtags:
+ Added tag V0_01 for changeset 19960ade3b9a
-2000-08-31 14:23 dj
+2002-04-12 21:04 +0000 dj <dj> (19960ade3b9a [V0_01])
- * Makefile.PL, Simple.pm, GNUmakefile, INSTALL, MANIFEST: Initial
- revision
+ * LICENSE, README: new file.
+ * LICENSE, README, Simple.pm:
+ 2002-04-12 21:04:33 by dj added license info
-2000-08-31 14:23 dj
+2007-07-31 13:34 -0400 djerius <djerius at cfa.harvard.edu> (b82227a5764b)
- * Makefile.PL, Simple.pm, GNUmakefile, INSTALL, MANIFEST: [no log
- message]
+ * .hgtags: new file.
+ * .hgtags:
+ Added tag initial for changeset 8ade7f132b43
+2000-08-31 18:23 +0000 dj <dj> (8ade7f132b43 [initial])
+
+ * GNUmakefile, INSTALL, MANIFEST: new file.
+ * GNUmakefile, INSTALL, MANIFEST:
+ 2000-08-31 18:23:47 by dj
+
+2000-08-31 18:23 +0000 dj <dj> (0c0b74076926)
+
+ * Makefile.PL, Simple.pm: new file.
+ * Makefile.PL, Simple.pm:
+ 2000-08-31 18:23:46 by dj Initial revision
+
+2007-07-31 13:34 -0400 djerius <djerius at cfa.harvard.edu> (22a363e7238c)
+
+ * .hgignore: new file.
+ * .hgignore:
+ Tailor preparing to convert repo by adding .hgignore
+
Modified: branches/upstream/libexpect-simple-perl/current/Changes
URL: http://svn.debian.org/wsvn/branches/upstream/libexpect-simple-perl/current/Changes?rev=19717&op=diff
==============================================================================
--- branches/upstream/libexpect-simple-perl/current/Changes (original)
+++ branches/upstream/libexpect-simple-perl/current/Changes Thu May 8 20:04:53 2008
@@ -1,4 +1,9 @@
Revision history for Perl extension Expect::Simple.
+
+0.04 Tue May 6 19:19:29 EDT 2008
+ - prevent deadlocks when spawn fails or command has exited
+ prematurely
+ - improve error output
0.03 Thu Aug 16 17:25:29 EDT 2007
- release
Modified: branches/upstream/libexpect-simple-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/branches/upstream/libexpect-simple-perl/current/MANIFEST?rev=19717&op=diff
==============================================================================
--- branches/upstream/libexpect-simple-perl/current/MANIFEST (original)
+++ branches/upstream/libexpect-simple-perl/current/MANIFEST Thu May 8 20:04:53 2008
@@ -3,7 +3,8 @@
lib/Expect/Simple.pm
LICENSE
Makefile.PL
-MANIFEST
+MANIFEST This list of files
+MANIFEST.SKIP
README
t/Expect-Simple.t
t/testprog
Added: branches/upstream/libexpect-simple-perl/current/MANIFEST.SKIP
URL: http://svn.debian.org/wsvn/branches/upstream/libexpect-simple-perl/current/MANIFEST.SKIP?rev=19717&op=file
==============================================================================
--- branches/upstream/libexpect-simple-perl/current/MANIFEST.SKIP (added)
+++ branches/upstream/libexpect-simple-perl/current/MANIFEST.SKIP Thu May 8 20:04:53 2008
@@ -1,0 +1,11 @@
+^.hg
+.old$
+.bak$
+Makefile$
+blib/
+~$
+pm_to_blib
+t/.*.stdout
+t/.*.stderr
+blibdirs
+.gz$
Modified: branches/upstream/libexpect-simple-perl/current/META.yml
URL: http://svn.debian.org/wsvn/branches/upstream/libexpect-simple-perl/current/META.yml?rev=19717&op=diff
==============================================================================
--- branches/upstream/libexpect-simple-perl/current/META.yml (original)
+++ branches/upstream/libexpect-simple-perl/current/META.yml Thu May 8 20:04:53 2008
@@ -1,12 +1,15 @@
-# http://module-build.sourceforge.net/META-spec.html
-#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
-name: Expect-Simple
-version: 0.03
-version_from: lib/Expect/Simple.pm
-installdirs: site
-requires:
+--- #YAML:1.0
+name: Expect-Simple
+version: 0.04
+abstract: wrapper around the Expect module
+license: gpl
+generated_by: ExtUtils::MakeMaker version 6.36
+distribution_type: module
+requires:
Expect: 0
Test::More: 0
-
-distribution_type: module
-generated_by: ExtUtils::MakeMaker version 6.30_01
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-v1.2.html
+ version: 1.2
+author:
+ - Diab Jerius <djerius at cpan.org>
Modified: branches/upstream/libexpect-simple-perl/current/lib/Expect/Simple.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libexpect-simple-perl/current/lib/Expect/Simple.pm?rev=19717&op=diff
==============================================================================
--- branches/upstream/libexpect-simple-perl/current/lib/Expect/Simple.pm (original)
+++ branches/upstream/libexpect-simple-perl/current/lib/Expect/Simple.pm Thu May 8 20:04:53 2008
@@ -6,7 +6,7 @@
use Carp;
use Expect;
-our $VERSION = '0.03';
+our $VERSION = '0.04';
sub new {
@@ -25,11 +25,11 @@
bless ($obj, $class);
my $attr = shift or
- croak( __PACKAGE__, ': must specify some attributes!\n' );
+ croak( __PACKAGE__, ': must specify some attributes!' );
while( my ( $attr, $val ) = each %{$attr} )
{
- croak( __PACKAGE__, ": attribute error : `$attr' is not recognized \n" )
+ croak( __PACKAGE__, ": attribute error : `$attr' is not recognized" )
unless exists $obj->{$attr};
$obj->{$attr} = $val;
@@ -39,7 +39,7 @@
# ensure all the attribures are set
foreach ( keys %$obj )
{
- croak( __PACKAGE__, ": must specify attribute `$_'\n" )
+ croak( __PACKAGE__, ": must specify attribute `$_'" )
unless defined $obj->{$_};
}
@@ -49,8 +49,11 @@
eval { $obj->_connect; };
-
- croak (__PACKAGE__, ': ', $@) if $@;
+ if ( $@ )
+ {
+ chomp $@;
+ croak (__PACKAGE__, ': ', $@);
+ }
return $obj;
}
@@ -67,38 +70,64 @@
print STDERR "Running command..."
if $obj->{Verbose};
- $obj->{_conn} = Expect->new();
-
- $obj->{_conn}->raw_pty(1) if $obj->{RawPty};
-
- $obj->{_conn}->spawn( 'ARRAY' eq ref($obj->{Cmd})
- ? @{$obj->{Cmd}}
- : $obj->{Cmd} )
- or croak( __PACKAGE__, ": error spawning command\n" );
+ # don't store the connection in the object until we're sure it's
+ # up. otherwise DESTROY will try to disconnect, which won't work...
+ delete $obj->{_conn};
+ my $conn = Expect->new();
+
+ $conn->raw_pty(1) if $obj->{RawPty};
+
+ # Expect docs say that upon failure of spawn, one can get the error
+ # from the next call to expect(). Unfortunately, that message is
+ # generated by a die in the forked child process, which means it has
+ # propagated up through the eval in Expect::Simple::new and
+ # had lots of cruft slapped onto it, front and back.
+ #
+ # instead, I use a horrible hack to grab the (undocumented) warning
+ # emitted by Expect if $^W is turned on.
+
+ {
+ my $error;
+ local $^W = 1;
+ local $SIG{__WARN__} = sub { chomp( $error = $_[0]); return; };
+
+ my $success =
+ $conn->spawn( 'ARRAY' eq ref($obj->{Cmd})
+ ? @{$obj->{Cmd}}
+ : $obj->{Cmd} );
+
+ if ( ! $success )
+ {
+ chomp $error;
+ die( "error spawning command: $error\n" );
+ }
+ }
print STDERR "done.\n"
if $obj->{Verbose};
- $obj->{_conn}->debug( $obj->{Debug} );
-
- $obj->{_conn}->log_stdout( $obj->{Verbose} > 3 ? 1 : 0 );
-
+ $conn->debug( $obj->{Debug} );
+
+ $conn->log_stdout( $obj->{Verbose} > 3 ? 1 : 0 );
+
+ $obj->{_conn} = $conn;
$obj->_expect( @{$obj->{Prompt}} )
- or croak( __PACKAGE__, ": couldn't find prompt\n");
+ or die( __PACKAGE__, ": couldn't find prompt\n");
}
sub _disconnect
{
my $obj = shift;
- return unless $obj->{_conn};
+ return unless
+ $obj->{_conn} && !defined $obj->{_conn}->exitstatus;
print STDERR "Disconnecting.\n"
if $obj->{Verbose};
$obj->{_conn}->print( $obj->{DisconnectCmd}, "\n" );
$obj->_expect( 'the unexpected' );
- croak( __PACKAGE__, ": disconnection error\n" )
+ croak( __PACKAGE__, ": disconnection error" )
unless $obj->{_conn}->exp_error =~ /^(2|3)/;
$obj->{_conn} = undef;
@@ -125,7 +154,7 @@
$obj->{_conn}->print( $_, "\n");
$obj->_expect( @{$obj->{Prompt}} ) ||
- croak( __PACKAGE__, ": couldn't find prompt after send\n");
+ croak( __PACKAGE__, ": couldn't find prompt after send");
}
}
@@ -160,7 +189,7 @@
else
{
my ( $errno, $errmsg) = /(\d):(.*)/;
-
+
$obj->{_error} = "error in communications: $errmsg";
}
@@ -170,13 +199,12 @@
1;
}
-sub error { shift()->{_error} }
+sub error { shift()->{_error} }
sub error_expect { shift()->{_conn}->exp_error }
-sub match_idx { shift()->{_conn}->exp_match_number }
-sub match_str { shift()->{_conn}->exp_match }
-sub before { shift()->{_conn}->exp_before }
-sub after { shift()->{_conn}->exp_after }
-
+sub match_idx { shift()->{_conn}->exp_match_number }
+sub match_str { shift()->{_conn}->exp_match }
+sub before { shift()->{_conn}->exp_before }
+sub after { shift()->{_conn}->exp_after }
sub expect_handle{ shift()->{_conn} }
sub DESTROY { shift()->_disconnect }
More information about the Pkg-perl-cvs-commits
mailing list