X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FTest-Valgrind.git;a=blobdiff_plain;f=lib%2FTest%2FValgrind%2FCommand%2FPerl.pm;h=3ded74a587c7ebbbb2f3cf61a4200a3a72b1b493;hp=a8e3e8d59f5fdcfbbadc8b90986ea109b3af03d6;hb=11eeabaad0bbb6db15b9c967fae94cd7388f0012;hpb=faf3290acd380f75314a2283314d0a8bcbf97065 diff --git a/lib/Test/Valgrind/Command/Perl.pm b/lib/Test/Valgrind/Command/Perl.pm index a8e3e8d..3ded74a 100644 --- a/lib/Test/Valgrind/Command/Perl.pm +++ b/lib/Test/Valgrind/Command/Perl.pm @@ -27,15 +27,31 @@ use base qw/Test::Valgrind::Command Test::Valgrind::Carp/; This class inherits L. -=head2 C<< new perl => $^X, inc => \@INC, ... >> +=head2 C<< new perl => $^X, inc => \@INC, taint_mode => $taint_mode, ... >> -Your usual constructor. +The package constructor, which takes several options : + +=over 4 + +=item * The C option specifies which C executable will run the arugment list given in C. -It defaults to C<$^X>. + +Defaults to C<$^X>. + +=item * C is a reference to an array of paths that will be passed as C<-I> to the invoked command. -It defaults to C<@INC>. + +Defaults to C<@INC>. + +=item * + +C<$taint_mode> is a boolean that specifies if the script should be run under taint mode. + +Defaults to false. + +=back Other arguments are passed straight to C<< Test::Valgrind::Command->new >>. @@ -47,16 +63,19 @@ sub new { my %args = @_; - my $perl = delete($args{perl}) || $^X; - my $inc = delete($args{inc}) || [ @INC ]; + my $perl = delete $args{perl} || $^X; + my $inc = delete $args{inc} || [ @INC ]; $class->_croak('Invalid INC list') unless ref $inc eq 'ARRAY'; + my $taint_mode = delete $args{taint_mode}; my $trainer_file = delete $args{trainer_file}; my $self = bless $class->SUPER::new(%args), $class; - $self->{perl} = $perl; - $self->{inc} = $inc; + $self->{perl} = $perl; + $self->{inc} = $inc; + $self->{taint_mode} = $taint_mode; + $self->{trainer_file} = $trainer_file; return $self; @@ -97,10 +116,19 @@ Read-only accessor for the C option. sub inc { @{$_[0]->{inc} || []} } +=head2 C + +Read-only accessor for the C option. + +=cut + +sub taint_mode { $_[0]->{taint_mode} } + sub args { my $self = shift; return $self->perl, + (('-T') x!! $self->taint_mode), map("-I$_", $self->inc), $self->SUPER::args(@_); }