X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FTest-Valgrind.git;a=blobdiff_plain;f=lib%2FTest%2FValgrind%2FSession.pm;h=ba00ee24e02028b4ac7a7d6c4e6ddc2c97671f9e;hp=ca586ea46caa7d4c91a28d57b61f1e73bb0e16c1;hb=5dd4ffc1370138eb1e9501f82a69f98208e4c0ff;hpb=ca8eca27f27c14e65e67ffce2fa1447eee64c5c1 diff --git a/lib/Test/Valgrind/Session.pm b/lib/Test/Valgrind/Session.pm index ca586ea..ba00ee2 100644 --- a/lib/Test/Valgrind/Session.pm +++ b/lib/Test/Valgrind/Session.pm @@ -29,10 +29,10 @@ use Fcntl (); # F_SETFD use IO::Select; use POSIX (); # SIGKILL, _exit() -use version (); - use base qw; +use Test::Valgrind::Version; + =head1 METHODS =head2 C @@ -120,19 +120,20 @@ sub new { $class->_croak('Empty valgrind candidates list') unless @paths; my $min_version = delete $args{min_version}; - defined and not ref and $_ = version->new($_) for $min_version; + if (defined $min_version) { + $min_version = Test::Valgrind::Version->new(string => $min_version); + } my ($valgrind, $version); for (@paths) { next unless -x; - my $ver = qx/$_ --version/; - if ($ver =~ /^valgrind-(\d+(\.\d+)*)/) { - if ($min_version) { - $version = version->new($1); - next if $version < $min_version; - } else { - $version = $1; - } + my $output = qx/$_ --version/; + $version = do { + local $@; + eval { Test::Valgrind::Version->new(command_output => $output) }; + }; + if (defined $version) { + next if defined $min_version and $version < $min_version; $valgrind = $_; last; } @@ -164,18 +165,7 @@ The path to the selected C executable. my $valgrind_version = $tvs->version; -The L object associated to the selected C. - -=cut - -sub version { - my ($self) = @_; - - my $version = $self->{version}; - $self->{version} = $version = version->new($version) unless ref $version; - - return $version; -} +The L object associated to the selected C. =head2 C @@ -201,6 +191,7 @@ Read-only accessor for the C option. eval "sub $_ { \$_[0]->{$_} }" for qw< valgrind + version regen_def_supp no_def_supp allow_no_supp @@ -625,7 +616,7 @@ sub status { $_[0]->{last_status} } L, L, L, L, L. -L, L. +L. =head1 AUTHOR