diff options
Diffstat (limited to 'Master/tlpkg/tlperl/lib/TAP/Parser/SourceHandler')
5 files changed, 40 insertions, 38 deletions
diff --git a/Master/tlpkg/tlperl/lib/TAP/Parser/SourceHandler/Executable.pm b/Master/tlpkg/tlperl/lib/TAP/Parser/SourceHandler/Executable.pm index f20e6514ab0..5522625d317 100644 --- a/Master/tlpkg/tlperl/lib/TAP/Parser/SourceHandler/Executable.pm +++ b/Master/tlpkg/tlperl/lib/TAP/Parser/SourceHandler/Executable.pm @@ -1,13 +1,12 @@ package TAP::Parser::SourceHandler::Executable; use strict; -use vars qw($VERSION @ISA); +use warnings; -use TAP::Parser::SourceHandler (); use TAP::Parser::IteratorFactory (); use TAP::Parser::Iterator::Process (); -@ISA = qw(TAP::Parser::SourceHandler); +use base 'TAP::Parser::SourceHandler'; TAP::Parser::IteratorFactory->register_handler(__PACKAGE__); @@ -17,11 +16,11 @@ TAP::Parser::SourceHandler::Executable - Stream output from an executable TAP so =head1 VERSION -Version 3.26 +Version 3.30 =cut -$VERSION = '3.26'; +our $VERSION = '3.30'; =head1 SYNOPSIS @@ -156,12 +155,11 @@ Please see L<TAP::Parser/SUBCLASSING> for a subclassing overview. package MyRubySourceHandler; use strict; - use vars '@ISA'; use Carp qw( croak ); use TAP::Parser::SourceHandler::Executable; - @ISA = qw( TAP::Parser::SourceHandler::Executable ); + use base 'TAP::Parser::SourceHandler::Executable'; # expect $handler->(['mytest.rb', 'cmdline', 'args']); sub make_iterator { diff --git a/Master/tlpkg/tlperl/lib/TAP/Parser/SourceHandler/File.pm b/Master/tlpkg/tlperl/lib/TAP/Parser/SourceHandler/File.pm index 1faacebe513..b48660fc782 100644 --- a/Master/tlpkg/tlperl/lib/TAP/Parser/SourceHandler/File.pm +++ b/Master/tlpkg/tlperl/lib/TAP/Parser/SourceHandler/File.pm @@ -1,13 +1,12 @@ package TAP::Parser::SourceHandler::File; use strict; -use vars qw($VERSION @ISA); +use warnings; -use TAP::Parser::SourceHandler (); use TAP::Parser::IteratorFactory (); use TAP::Parser::Iterator::Stream (); -@ISA = qw(TAP::Parser::SourceHandler); +use base 'TAP::Parser::SourceHandler'; TAP::Parser::IteratorFactory->register_handler(__PACKAGE__); @@ -17,11 +16,11 @@ TAP::Parser::SourceHandler::File - Stream TAP from a text file. =head1 VERSION -Version 3.26 +Version 3.30 =cut -$VERSION = '3.26'; +our $VERSION = '3.30'; =head1 SYNOPSIS diff --git a/Master/tlpkg/tlperl/lib/TAP/Parser/SourceHandler/Handle.pm b/Master/tlpkg/tlperl/lib/TAP/Parser/SourceHandler/Handle.pm index f0043471250..944fb2a9b37 100644 --- a/Master/tlpkg/tlperl/lib/TAP/Parser/SourceHandler/Handle.pm +++ b/Master/tlpkg/tlperl/lib/TAP/Parser/SourceHandler/Handle.pm @@ -1,13 +1,12 @@ package TAP::Parser::SourceHandler::Handle; use strict; -use vars qw($VERSION @ISA); +use warnings; -use TAP::Parser::SourceHandler (); use TAP::Parser::IteratorFactory (); use TAP::Parser::Iterator::Stream (); -@ISA = qw(TAP::Parser::SourceHandler); +use base 'TAP::Parser::SourceHandler'; TAP::Parser::IteratorFactory->register_handler(__PACKAGE__); @@ -17,11 +16,11 @@ TAP::Parser::SourceHandler::Handle - Stream TAP from an IO::Handle or a GLOB. =head1 VERSION -Version 3.26 +Version 3.30 =cut -$VERSION = '3.26'; +our $VERSION = '3.30'; =head1 SYNOPSIS diff --git a/Master/tlpkg/tlperl/lib/TAP/Parser/SourceHandler/Perl.pm b/Master/tlpkg/tlperl/lib/TAP/Parser/SourceHandler/Perl.pm index 97eba8ebc17..1a1867b922d 100644 --- a/Master/tlpkg/tlperl/lib/TAP/Parser/SourceHandler/Perl.pm +++ b/Master/tlpkg/tlperl/lib/TAP/Parser/SourceHandler/Perl.pm @@ -1,18 +1,17 @@ package TAP::Parser::SourceHandler::Perl; use strict; +use warnings; use Config; -use vars qw($VERSION @ISA); use constant IS_WIN32 => ( $^O =~ /^(MS)?Win32$/ ); use constant IS_VMS => ( $^O eq 'VMS' ); -use TAP::Parser::SourceHandler::Executable (); use TAP::Parser::IteratorFactory (); use TAP::Parser::Iterator::Process (); -use TAP::Parser::Utils qw( split_shell ); +use Text::ParseWords qw(shellwords); -@ISA = 'TAP::Parser::SourceHandler::Executable'; +use base 'TAP::Parser::SourceHandler::Executable'; TAP::Parser::IteratorFactory->register_handler(__PACKAGE__); @@ -22,11 +21,11 @@ TAP::Parser::SourceHandler::Perl - Stream TAP from a Perl executable =head1 VERSION -Version 3.26 +Version 3.30 =cut -$VERSION = '3.26'; +our $VERSION = '3.30'; =head1 SYNOPSIS @@ -152,18 +151,27 @@ sub make_iterator { $class->_run( $source, $libs, $switches ); } + +sub _has_taint_switch { + my( $class, $switches ) = @_; + + my $has_taint = grep { $_ eq "-T" || $_ eq "-t" } @{$switches}; + return $has_taint ? 1 : 0; +} + sub _mangle_switches { my ( $class, $libs, $switches ) = @_; # Taint mode ignores environment variables so we must retranslate # PERL5LIB as -I switches and place PERL5OPT on the command line # in order that it be seen. - if ( grep { $_ eq "-T" || $_ eq "-t" } @{$switches} ) { + if ( $class->_has_taint_switch($switches) ) { + my @perl5lib = defined $ENV{PERL5LIB} ? split /$Config{path_sep}/, $ENV{PERL5LIB} : (); return ( $libs, [ @{$switches}, - $class->_libs2switches($libs), - split_shell( $ENV{PERL5OPT} ) + $class->_libs2switches([@$libs, @perl5lib]), + defined $ENV{PERL5OPT} ? shellwords( $ENV{PERL5OPT} ) : () ], ); } @@ -200,10 +208,10 @@ sub _filter_libs { } sub _iterator_hooks { - my ( $class, $source, $libs ) = @_; + my ( $class, $source, $libs, $switches ) = @_; my $setup = sub { - if ( @{$libs} ) { + if ( @{$libs} and !$class->_has_taint_switch($switches) ) { $ENV{PERL5LIB} = join( $Config{path_sep}, grep {defined} @{$libs}, $ENV{PERL5LIB} @@ -211,8 +219,8 @@ sub _iterator_hooks { } }; - # Cargo culted from comments seen elsewhere about VMS / environment - # variables. I don't know if this is actually necessary. + # VMS environment variables aren't guaranteed to reset at the end of + # the process, so we need to put PERL5LIB back. my $previous = $ENV{PERL5LIB}; my $teardown = sub { if ( defined $previous ) { @@ -232,7 +240,7 @@ sub _run { my @command = $class->_get_command_for_switches( $source, $switches ) or $class->_croak("No command found!"); - my ( $setup, $teardown ) = $class->_iterator_hooks( $source, $libs ); + my ( $setup, $teardown ) = $class->_iterator_hooks( $source, $libs, $switches ); return $class->_create_iterator( $source, \@command, $setup, $teardown ); } @@ -333,11 +341,10 @@ Please see L<TAP::Parser/SUBCLASSING> for a subclassing overview. package MyPerlSourceHandler; use strict; - use vars '@ISA'; use TAP::Parser::SourceHandler::Perl; - @ISA = qw( TAP::Parser::SourceHandler::Perl ); + use base 'TAP::Parser::SourceHandler::Perl'; # use the version of perl from the shebang line in the test file sub get_perl { diff --git a/Master/tlpkg/tlperl/lib/TAP/Parser/SourceHandler/RawTAP.pm b/Master/tlpkg/tlperl/lib/TAP/Parser/SourceHandler/RawTAP.pm index 04b4b9c2da1..627a1e1311a 100644 --- a/Master/tlpkg/tlperl/lib/TAP/Parser/SourceHandler/RawTAP.pm +++ b/Master/tlpkg/tlperl/lib/TAP/Parser/SourceHandler/RawTAP.pm @@ -1,13 +1,12 @@ package TAP::Parser::SourceHandler::RawTAP; use strict; -use vars qw($VERSION @ISA); +use warnings; -use TAP::Parser::SourceHandler (); use TAP::Parser::IteratorFactory (); use TAP::Parser::Iterator::Array (); -@ISA = qw(TAP::Parser::SourceHandler); +use base 'TAP::Parser::SourceHandler'; TAP::Parser::IteratorFactory->register_handler(__PACKAGE__); @@ -17,11 +16,11 @@ TAP::Parser::SourceHandler::RawTAP - Stream output from raw TAP in a scalar/arra =head1 VERSION -Version 3.26 +Version 3.30 =cut -$VERSION = '3.26'; +our $VERSION = '3.30'; =head1 SYNOPSIS |