Skip to content

Commit

Permalink
r4196@vesta (orig r705): dagolden | 2006-08-17 07:33:11 -0400
Browse files Browse the repository at this point in the history
 - store a copy of ptee in auto/Tee for tee()
 - removed unused test files
 - downgraded IPC::Run3 prereq version to 0.033
 


git-svn-id: https://dagolden.googlecode.com/svn/Tee/trunk@717 dfce27d5-b31c-0410-bb09-030b4413eeba
  • Loading branch information
xdg committed Sep 9, 2006
1 parent a296b72 commit dfcf832
Show file tree
Hide file tree
Showing 12 changed files with 48 additions and 71 deletions.
25 changes: 24 additions & 1 deletion Build.PL
Expand Up @@ -6,6 +6,29 @@ my $class = Module::Build->subclass(
class => "Module::Build::WikiDoc", class => "Module::Build::WikiDoc",
code => <<'SUBCLASS', ); code => <<'SUBCLASS', );
sub ACTION_build {
my $self = shift;
$self->SUPER::ACTION_build;
$self->depends_on('share');
}
sub ACTION_share {
my $self = shift;
my $blib = $self->blib;
my @dist_names = split "/-/", $self->dist_name;
my $autodir = File::Spec->catdir($blib, 'lib', 'auto', @dist_names);
File::Path::mkpath( $autodir );
for my $f ( @{ $self->rscan_dir( 'scripts', '.' ) } ) {
next if $f eq 'scripts';
my $to = File::Spec->abs2rel( $f, 'scripts' );
$self->copy_if_modified(
from => $f,
to => File::Spec->catfile( $autodir, $to ),
verbose => 1
);
}
}
sub ACTION_wikidoc { sub ACTION_wikidoc {
my $self = shift; my $self = shift;
eval "use Pod::WikiDoc"; eval "use Pod::WikiDoc";
Expand Down Expand Up @@ -69,7 +92,7 @@ $class->new(
'File::Basename' => 0, 'File::Basename' => 0,
'File::Spec' => 0, 'File::Spec' => 0,
'Getopt::Long' => 2.32, 'Getopt::Long' => 2.32,
'IPC::Run3' => 0.035, 'IPC::Run3' => 0.033,
'Probe::Perl' => 0, 'Probe::Perl' => 0,
'Test::More' => 0.45, # thread-safe 'Test::More' => 0.45, # thread-safe
}, },
Expand Down
5 changes: 5 additions & 0 deletions Changes
@@ -1,5 +1,10 @@
Revision history for Perl module Tee Revision history for Perl module Tee


0.12
- store a copy of ptee in auto/Tee for tee()
- removed unused test files
- downgraded IPC::Run3 prereq version to 0.033

0.11 Thu Aug 3 14:49:31 EDT 2006 0.11 Thu Aug 3 14:49:31 EDT 2006
- added multiple file support to tee() to match documentation - added multiple file support to tee() to match documentation
- Pod addition and cleanups - Pod addition and cleanups
Expand Down
3 changes: 0 additions & 3 deletions MANIFEST
Expand Up @@ -13,11 +13,8 @@ scripts/ptee
t/01_Tee.t t/01_Tee.t
t/02_tee_script.t t/02_tee_script.t
t/03_tee_function.t t/03_tee_function.t
t/04_exit-codes.t
t/98_pod.t t/98_pod.t
t/99_pod-coverage.t t/99_pod-coverage.t
t/Expected.pm t/Expected.pm
t/fail.pl
t/helloworld.pl t/helloworld.pl
t/succeed.pl
Todo Todo
2 changes: 2 additions & 0 deletions Todo
Expand Up @@ -2,4 +2,6 @@ TODO list for Perl module Tee


- test tee() with multiple files - test tee() with multiple files


- have Tee create a temporary ptee if it can't find one!



17 changes: 12 additions & 5 deletions lib/Tee.pm
@@ -1,6 +1,6 @@
package Tee; package Tee;


$VERSION = "0.11"; $VERSION = "0.12";
@ISA = qw (Exporter); @ISA = qw (Exporter);
@EXPORT = qw (tee); @EXPORT = qw (tee);


Expand All @@ -20,8 +20,12 @@ my $p = Probe::Perl->new;
my $perl = $p->find_perl_interpreter; my $perl = $p->find_perl_interpreter;
my $ptee_cmd; my $ptee_cmd;
my $to_devnull = " > " . File::Spec->devnull . " 2>&1"; my $to_devnull = " > " . File::Spec->devnull . " 2>&1";
for my $path ( split($p->config('path_sep'), $ENV{PATH}) ) {
my $try_ptee = File::Spec->catfile( $path, PTEE ); # On installation, we store a copy of ptee in auto/Tee so we're sure
# to find it later without worrying about $ENV{PATH}

for my $path ( @INC ) {
my $try_ptee = File::Spec->catfile( $path, 'auto', 'Tee', PTEE );
next unless -r $try_ptee; next unless -r $try_ptee;
if ( system("$try_ptee -V $to_devnull" ) == 0 ) { if ( system("$try_ptee -V $to_devnull" ) == 0 ) {
$ptee_cmd = $try_ptee; $ptee_cmd = $try_ptee;
Expand All @@ -33,13 +37,12 @@ for my $path ( split($p->config('path_sep'), $ENV{PATH}) ) {
} }
} }


die "Couldn't find a working " . PTEE . "\n" unless $ptee_cmd;

#--------------------------------------------------------------------------# #--------------------------------------------------------------------------#
# Functions # Functions
#--------------------------------------------------------------------------# #--------------------------------------------------------------------------#


sub tee { sub tee {
die "Couldn't find a working " . PTEE . "\n" unless $ptee_cmd;
my $command = shift; my $command = shift;
my $options; my $options;
$options = shift if (ref $_[0] eq 'HASH'); $options = shift if (ref $_[0] eq 'HASH');
Expand All @@ -62,6 +65,10 @@ __END__
Tee - Pure Perl emulation of GNU tee Tee - Pure Perl emulation of GNU tee
= VERSION
This documentation refers to version %%VERSION%%
= SYNOPSIS = SYNOPSIS
# from Perl # from Perl
Expand Down
4 changes: 4 additions & 0 deletions lib/Tee.pod
Expand Up @@ -6,6 +6,10 @@


Tee - Pure Perl emulation of GNU tee Tee - Pure Perl emulation of GNU tee


=head1 VERSION

This documentation refers to version 0.12

=head1 SYNOPSIS =head1 SYNOPSIS


# from Perl # from Perl
Expand Down
2 changes: 1 addition & 1 deletion scripts/ptee
@@ -1,7 +1,7 @@
#!/usr/bin/perl #!/usr/bin/perl


# ptee -- perl implementation of unix tee # ptee -- perl implementation of unix tee
$VERSION = '0.11'; $VERSION = '0.12';
use strict; use strict;
use File::Basename qw/basename/; use File::Basename qw/basename/;
use Getopt::Long; use Getopt::Long;
Expand Down
6 changes: 0 additions & 6 deletions t/01_Tee.t
Expand Up @@ -11,15 +11,9 @@ select($stdout);
$|++; $|++;


#--------------------------------------------------------------------------# #--------------------------------------------------------------------------#
use Probe::Perl;
use Test::More; use Test::More;


plan tests => 1 ; plan tests => 1 ;


my $pp = Probe::Perl->new;
my $perl = $pp->find_perl_interpreter;
my $path_sep = $pp->config("path_sep");
$ENV{PATH} = join( $path_sep, 'scripts', split( $path_sep, $ENV{PATH} ) );

require_ok( 'Tee' ); require_ok( 'Tee' );


3 changes: 0 additions & 3 deletions t/03_tee_function.t
Expand Up @@ -22,16 +22,13 @@ $|=1;


my $pp = Probe::Perl->new; my $pp = Probe::Perl->new;
my $perl = $pp->find_perl_interpreter; my $perl = $pp->find_perl_interpreter;
my $path_sep = $pp->config("path_sep");
my $hello = File::Spec->catfile(qw/t helloworld.pl/); my $hello = File::Spec->catfile(qw/t helloworld.pl/);
my $tee = File::Spec->catfile(qw/scripts ptee/); my $tee = File::Spec->catfile(qw/scripts ptee/);
my $tempfh = File::Temp->new; my $tempfh = File::Temp->new;
my $tempfh2 = File::Temp->new; my $tempfh2 = File::Temp->new;
my $tempname = $tempfh->filename; my $tempname = $tempfh->filename;
my ($got_stdout, $got_stderr); my ($got_stdout, $got_stderr);


$ENV{PATH} = join( $path_sep, 'scripts', split( $path_sep, $ENV{PATH} ) );

#--------------------------------------------------------------------------# #--------------------------------------------------------------------------#
# Begin test plan # Begin test plan
#--------------------------------------------------------------------------# #--------------------------------------------------------------------------#
Expand Down
50 changes: 0 additions & 50 deletions t/04_exit-codes.t

This file was deleted.

1 change: 0 additions & 1 deletion t/fail.pl

This file was deleted.

1 change: 0 additions & 1 deletion t/succeed.pl

This file was deleted.

0 comments on commit dfcf832

Please sign in to comment.