Skip to content
Browse files

r4196@vesta (orig r705): dagolden | 2006-08-17 07:33:11 -0400

 - 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...
1 parent a296b72 commit dfcf8326faca4783e539d8692e794ce4e10f685f @xdg xdg committed
Showing with 48 additions and 71 deletions.
  1. +24 −1 Build.PL
  2. +5 −0 Changes
  3. +0 −3 MANIFEST
  4. +2 −0 Todo
  5. +12 −5 lib/Tee.pm
  6. +4 −0 lib/Tee.pod
  7. +1 −1 scripts/ptee
  8. +0 −6 t/01_Tee.t
  9. +0 −3 t/03_tee_function.t
  10. +0 −50 t/04_exit-codes.t
  11. +0 −1 t/fail.pl
  12. +0 −1 t/succeed.pl
View
25 Build.PL
@@ -6,6 +6,29 @@ my $class = Module::Build->subclass(
class => "Module::Build::WikiDoc",
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 {
my $self = shift;
eval "use Pod::WikiDoc";
@@ -69,7 +92,7 @@ $class->new(
'File::Basename' => 0,
'File::Spec' => 0,
'Getopt::Long' => 2.32,
- 'IPC::Run3' => 0.035,
+ 'IPC::Run3' => 0.033,
'Probe::Perl' => 0,
'Test::More' => 0.45, # thread-safe
},
View
5 Changes
@@ -1,5 +1,10 @@
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
- added multiple file support to tee() to match documentation
- Pod addition and cleanups
View
3 MANIFEST
@@ -13,11 +13,8 @@ scripts/ptee
t/01_Tee.t
t/02_tee_script.t
t/03_tee_function.t
-t/04_exit-codes.t
t/98_pod.t
t/99_pod-coverage.t
t/Expected.pm
-t/fail.pl
t/helloworld.pl
-t/succeed.pl
Todo
View
2 Todo
@@ -2,4 +2,6 @@ TODO list for Perl module Tee
- test tee() with multiple files
+- have Tee create a temporary ptee if it can't find one!
+
View
17 lib/Tee.pm
@@ -1,6 +1,6 @@
package Tee;
-$VERSION = "0.11";
+$VERSION = "0.12";
@ISA = qw (Exporter);
@EXPORT = qw (tee);
@@ -20,8 +20,12 @@ my $p = Probe::Perl->new;
my $perl = $p->find_perl_interpreter;
my $ptee_cmd;
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;
if ( system("$try_ptee -V $to_devnull" ) == 0 ) {
$ptee_cmd = $try_ptee;
@@ -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
#--------------------------------------------------------------------------#
sub tee {
+ die "Couldn't find a working " . PTEE . "\n" unless $ptee_cmd;
my $command = shift;
my $options;
$options = shift if (ref $_[0] eq 'HASH');
@@ -62,6 +65,10 @@ __END__
Tee - Pure Perl emulation of GNU tee
+= VERSION
+
+This documentation refers to version %%VERSION%%
+
= SYNOPSIS
# from Perl
View
4 lib/Tee.pod
@@ -6,6 +6,10 @@
Tee - Pure Perl emulation of GNU tee
+=head1 VERSION
+
+This documentation refers to version 0.12
+
=head1 SYNOPSIS
# from Perl
View
2 scripts/ptee
@@ -1,7 +1,7 @@
#!/usr/bin/perl
# ptee -- perl implementation of unix tee
-$VERSION = '0.11';
+$VERSION = '0.12';
use strict;
use File::Basename qw/basename/;
use Getopt::Long;
View
6 t/01_Tee.t
@@ -11,15 +11,9 @@ select($stdout);
$|++;
#--------------------------------------------------------------------------#
-use Probe::Perl;
use Test::More;
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' );
View
3 t/03_tee_function.t
@@ -22,7 +22,6 @@ $|=1;
my $pp = Probe::Perl->new;
my $perl = $pp->find_perl_interpreter;
-my $path_sep = $pp->config("path_sep");
my $hello = File::Spec->catfile(qw/t helloworld.pl/);
my $tee = File::Spec->catfile(qw/scripts ptee/);
my $tempfh = File::Temp->new;
@@ -30,8 +29,6 @@ my $tempfh2 = File::Temp->new;
my $tempname = $tempfh->filename;
my ($got_stdout, $got_stderr);
-$ENV{PATH} = join( $path_sep, 'scripts', split( $path_sep, $ENV{PATH} ) );
-
#--------------------------------------------------------------------------#
# Begin test plan
#--------------------------------------------------------------------------#
View
50 t/04_exit-codes.t
@@ -1,50 +0,0 @@
-# Tee tests
-use strict;
-use File::Spec;
-use File::Temp;
-use IPC::Run3;
-use Probe::Perl;
-use Test::More;
-use t::Expected;
-
-#--------------------------------------------------------------------------#
-# autoflush to keep output in order
-#--------------------------------------------------------------------------#
-
-my $stdout = select(STDERR);
-$|=1;
-select($stdout);
-$|=1;
-
-#--------------------------------------------------------------------------#
-# Declarations
-#--------------------------------------------------------------------------#
-
-my $pp = Probe::Perl->new;
-my $perl = $pp->find_perl_interpreter;
-my $path_sep = $pp->config("path_sep");
-my $succeed = File::Spec->catfile(qw/ t succeed.pl /);
-my $fail = File::Spec->catfile(qw/ t fail.pl /);
-my $tempfh = File::Temp->new();
-
-$ENV{PATH} = join( $path_sep, 'scripts', split( $path_sep, $ENV{PATH} ) );
-
-#--------------------------------------------------------------------------#
-# Begin test plan
-#--------------------------------------------------------------------------#
-
-plan skip_all => "exit code passthrough not supported";
-#plan tests => 4 ;
-
-require_ok( "Tee" );
-Tee->import;
-
-can_ok( "main", "tee" );
-
-is( tee("$perl $succeed", $tempfh), 0,
- "passthrough exit 0"
-);
-
-is( tee("$perl $fail", $tempfh), 1,
- "passthrough exit 1"
-);
View
1 t/fail.pl
@@ -1 +0,0 @@
-exit 1
View
1 t/succeed.pl
@@ -1 +0,0 @@
-exit 0;

0 comments on commit dfcf832

Please sign in to comment.
Something went wrong with that request. Please try again.