diff options
author | Jesse Luehrs <doy@tozt.net> | 2012-03-05 00:36:07 -0600 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2012-03-05 00:36:07 -0600 |
commit | f37b732fa2a9f4c4e31c602fb3309bc882400ab9 (patch) | |
tree | 1f3c7a1cf99b494ac39f8ac28d9ae041e3806418 | |
parent | 4e21bde42072a32e0a7cc515546ce9f13ecc8833 (diff) | |
download | io-pty-easy-f37b732fa2a9f4c4e31c602fb3309bc882400ab9.tar.gz io-pty-easy-f37b732fa2a9f4c4e31c602fb3309bc882400ab9.zip |
cleanups, dzil stuff, etc
-rw-r--r-- | .gitignore | 17 | ||||
-rw-r--r-- | Changes | 18 | ||||
-rw-r--r-- | dist.ini | 10 | ||||
-rw-r--r-- | lib/IO/Pty/Easy.pm | 70 | ||||
-rw-r--r-- | t/000-load.t | 7 | ||||
-rw-r--r-- | t/open-close.t (renamed from t/001-open-close.t) | 6 | ||||
-rw-r--r-- | t/read-write.t (renamed from t/010-read-write.t) | 6 | ||||
-rw-r--r-- | t/spawn.t (renamed from t/002-spawn.t) | 6 | ||||
-rw-r--r-- | t/subprocess.t (renamed from t/003-subprocess.t) | 6 | ||||
-rw-r--r-- | t/system.t (renamed from t/100-system.t) | 4 | ||||
-rw-r--r-- | t/undefined-program.t (renamed from t/004-undefined-program.t) | 6 |
11 files changed, 79 insertions, 77 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..dc6fde8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,17 @@ +cover_db +META.* +MYMETA.* +Makefile +blib +inc +pm_to_blib +MANIFEST +Makefile.old +nytprof.out +MANIFEST.bak +*.sw[po] +.DS_Store +.build +IO-Pty-Easy-* +*.bs +*.o @@ -1,10 +1,12 @@ Revision history for IO-Pty-Easy -0.08 10/10/2009 +{{$NEXT}} + +0.08 2009-10-10 - Fixed some circular references, should fix global destruction issues (reported by kbrint, RT#50373) -0.07 07/07/2009 +0.07 2009-07-07 - Add a constructor option 'raw' (default true) to configure whether the pty should be set to raw mode on spawn. - Don't ever automatically set the master side of the pty to raw, since @@ -12,7 +14,7 @@ Revision history for IO-Pty-Easy anything?) - Build system changed to Dist::Zilla -0.06 07/06/2009 +0.06 2009-07-06 - Localize $@ and $? in the destructor - Convert the module to use the actual pty object as the class instance, rather than hiding it away in the hashref - now things like fileno($pty) @@ -20,26 +22,26 @@ Revision history for IO-Pty-Easy you have been digging around in the hash prior to this. - Add a few accessors for the object state -0.05 02/04/2009 +0.05 2009-02-04 - Fix read() returning undef on timeout -0.04 02/03/2009 +0.04 2009-02-03 - Don't mess with SIGCHLD, it breaks system() and `` - Don't die if $pty->close is called multiple times (and close on DESTROY) - Don't mess with SIGWINCH if we weren't the ones that set it up - Sleep while waiting for a process to die, rather than spinning - FreeBSD should pass all tests now (sorear) -0.03 08/20/2007 +0.03 2007-08-20 - Make sure stdin/out are connected to a tty before trying to clone winsize from them - Fix the subprocess test so that it waits for the read before the subprocess dies -0.02 08/17/2007 +0.02 2007-08-17 - Made calls which could possibly terminate the subprocess blocking by default - A few other minor bug fixes, doc fixes, and general cleanups -0.01 08/17/2007 +0.01 2007-08-17 - Initial release @@ -1,12 +1,10 @@ name = IO-Pty-Easy -version = 0.08 author = Jesse Luehrs <doy at tozt dot net> license = Perl_5 copyright_holder = Jesse Luehrs -abstract = Easy interface to IO::Pty -[@Classic] +[@DOY] +dist = IO-Pty-Easy +repository = github -[Prereq] -IO::Pty = 0 -Scalar::Util = 0 +[AutoPrereqs] diff --git a/lib/IO/Pty/Easy.pm b/lib/IO/Pty/Easy.pm index 904fbd5..9439332 100644 --- a/lib/IO/Pty/Easy.pm +++ b/lib/IO/Pty/Easy.pm @@ -1,14 +1,13 @@ package IO::Pty::Easy; use warnings; use strict; -use base 'IO::Pty'; +# ABSTRACT: Easy interface to IO::Pty + use Carp; use POSIX (); use Scalar::Util qw(weaken); -=head1 NAME - -IO::Pty::Easy - Easy interface to IO::Pty +use base 'IO::Pty'; =head1 SYNOPSIS @@ -41,11 +40,7 @@ portability restrictions from that module. =cut -=head1 CONSTRUCTOR - -=cut - -=head2 new() +=method new(%params) The C<new> constructor initializes the pty and returns a new C<IO::Pty::Easy> object. The constructor recognizes these parameters: @@ -97,11 +92,7 @@ sub new { return $self; } -=head1 METHODS - -=cut - -=head2 spawn() +=method spawn(@argv) Fork a new subprocess, with stdin/stdout/stderr tied to the pty. @@ -185,7 +176,7 @@ sub spawn { } } -=head2 read() +=method read($timeout, $length) Read data from the process running on the pty. @@ -223,7 +214,7 @@ sub read { return $buf; } -=head2 write() +=method write($buf, $timeout) Writes a string to the pty. @@ -251,7 +242,7 @@ sub write { return $nchars; } -=head2 is_active() +=method is_active Returns whether or not a subprocess is currently running on the pty. @@ -289,7 +280,7 @@ sub is_active { return $active; } -=head2 kill() +=method kill($sig, $non_blocking) Sends a signal to the process currently running on the pty (if any). Optionally blocks until the process dies. @@ -315,7 +306,7 @@ sub kill { return $kills; } -=head2 close() +=method close Kills any subprocesses and closes the pty. No other operations are valid after this call. @@ -329,10 +320,10 @@ sub close { $self->kill; } -=head2 handle_pty_size() +=method handle_pty_size Read/write accessor for the C<handle_pty_size> option documented in -L<the constructor options|/new()>. +L<the constructor options|/new(%params)>. =cut @@ -342,10 +333,10 @@ sub handle_pty_size { ${*{$self}}{io_pty_easy_handle_pty_size}; } -=head2 def_max_read_chars() +=method def_max_read_chars Read/write accessor for the C<def_max_read_chars> option documented in -L<the constructor options|/new()>. +L<the constructor options|/new(%params)>. =cut @@ -355,7 +346,7 @@ sub def_max_read_chars { ${*{$self}}{io_pty_easy_def_max_read_chars}; } -=head2 pid() +=method pid Returns the pid of the process currently running in the pty, or undef if no process is running. @@ -380,20 +371,6 @@ sub DESTROY { $self->close; } -=head1 SEE ALSO - -L<IO::Pty> - -L<Expect> - -L<IO::Pty::HalfDuplex> - -=head1 AUTHOR - -Jesse Luehrs, C<< <doy at tozt dot net> >> - -This module is based heavily on the F<try> script bundled with L<IO::Pty>. - =head1 BUGS No known bugs. @@ -402,6 +379,16 @@ Please report any bugs through RT: email C<bug-io-pty-easy at rt.cpan.org>, or browse to L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=IO-Pty-Easy>. +=head1 SEE ALSO + +L<IO::Pty> + +(This module is based heavily on the F<try> script bundled with L<IO::Pty>.) + +L<Expect> + +L<IO::Pty::HalfDuplex> + =head1 SUPPORT You can find this documentation for this module with the perldoc command. @@ -430,13 +417,6 @@ L<http://search.cpan.org/dist/IO-Pty-Easy> =back -=head1 COPYRIGHT AND LICENSE - -Copyright 2007-2009 Jesse Luehrs. - -This program is free software; you can redistribute it and/or modify it -under the same terms as Perl itself. - =cut 1; diff --git a/t/000-load.t b/t/000-load.t deleted file mode 100644 index 982a1ef..0000000 --- a/t/000-load.t +++ /dev/null @@ -1,7 +0,0 @@ -#!perl -use strict; -use warnings; -use Test::More tests => 1; - -use_ok 'IO::Pty::Easy'; - diff --git a/t/001-open-close.t b/t/open-close.t index 1c9eed1..6140821 100644 --- a/t/001-open-close.t +++ b/t/open-close.t @@ -1,9 +1,11 @@ -#!perl +#!/usr/bin/env perl use strict; use warnings; -use Test::More tests => 1; +use Test::More; use IO::Pty::Easy; my $pty = IO::Pty::Easy->new; $pty->close; ok(!$pty->opened, "closing a pty before a spawn"); + +done_testing; diff --git a/t/010-read-write.t b/t/read-write.t index 80f5f1e..21fe729 100644 --- a/t/010-read-write.t +++ b/t/read-write.t @@ -1,7 +1,7 @@ -#!perl +#!/usr/bin/env perl use strict; use warnings; -use Test::More tests => 5; +use Test::More; use IO::Pty::Easy; my $pty = IO::Pty::Easy->new; @@ -46,3 +46,5 @@ TODO: { # with the exit status of the signal that the subprocess dies with, so we have # to kill the subprocess before exiting. $pty->close; + +done_testing; diff --git a/t/002-spawn.t b/t/spawn.t index 620a57a..9bdc498 100644 --- a/t/002-spawn.t +++ b/t/spawn.t @@ -1,7 +1,7 @@ -#!perl +#!/usr/bin/env perl use strict; use warnings; -use Test::More tests => 5; +use Test::More; use IO::Pty::Easy; my $pty = IO::Pty::Easy->new; @@ -14,3 +14,5 @@ $pty->spawn("$^X -ple ''"); $pty->close; ok(!$pty->is_active, "auto-killing a pty with close()"); ok(!$pty->opened, "closing a pty after a spawn"); + +done_testing; diff --git a/t/003-subprocess.t b/t/subprocess.t index cc87025..d889074 100644 --- a/t/003-subprocess.t +++ b/t/subprocess.t @@ -1,7 +1,7 @@ -#!perl +#!/usr/bin/env perl use strict; use warnings; -use Test::More tests => 2; +use Test::More; use IO::Pty::Easy; my $pty = IO::Pty::Easy->new; @@ -19,3 +19,5 @@ $script .= "sleep 1 while 1;"; $pty->spawn("$^X -e '$script'"); like($pty->read, qr/ok/, "runs subprocess in a pty"); $pty->close; + +done_testing; diff --git a/t/100-system.t b/t/system.t index 0be6006..c6fb29e 100644 --- a/t/100-system.t +++ b/t/system.t @@ -1,7 +1,7 @@ #!/usr/bin/env perl use strict; use warnings; -use Test::More tests => 4; +use Test::More; use IO::Pty::Easy; my $pty = IO::Pty::Easy->new; @@ -26,3 +26,5 @@ eval { isnt($@, "alarm2\n", "system() didn't time out (after kill)"); is($output, "bar", "system() got the right value (after kill)"); $pty->close; + +done_testing; diff --git a/t/004-undefined-program.t b/t/undefined-program.t index 335a415..f53d065 100644 --- a/t/004-undefined-program.t +++ b/t/undefined-program.t @@ -1,7 +1,7 @@ -#!perl +#!/usr/bin/env perl use strict; use warnings; -use Test::More tests => 2; +use Test::More; use IO::Pty::Easy; my $pty = IO::Pty::Easy->new; @@ -13,3 +13,5 @@ eval { }; like($@, qr/Cannot exec\(missing_program_io_pty_easy\)/); ok(!$pty->is_active, "pty isn't active if program doesn't exist"); + +done_testing; |