]> git.vpit.fr Git - perl/modules/Test-Valgrind.git/blobdiff - lib/Test/Valgrind/Session.pm
Don't scan for valgrind at configure time
[perl/modules/Test-Valgrind.git] / lib / Test / Valgrind / Session.pm
index fe521a0e0907ef8edc18d36c253c538131b4af83..c7240b9fe4ae3de9c6e0995c5c5bcf0c7778ca6d 100644 (file)
@@ -22,15 +22,13 @@ It also acts as a dispatcher between the different components.
 
 =cut
 
-# All these modules are required at configure time.
+use File::Spec   ();
+use Scalar::Util ();
 
-BEGIN {
- require File::Spec;
- require Scalar::Util;
+use Fcntl (); # F_SETFD
+use POSIX (); # SIGKILL
 
- require Fcntl; # F_SETFD
- require POSIX; # SIGKILL
-}
+use version ();
 
 use base qw/Test::Valgrind::Carp/;
 
@@ -78,11 +76,6 @@ Defaults to none.
 
 =cut
 
-my $build_version = sub {
- require version;
- version->new($_[0]);
-};
-
 sub new {
  my $class = shift;
  $class = ref($class) || $class;
@@ -103,7 +96,7 @@ sub new {
  $class->_croak('Empty valgrind candidates list') unless @paths;
 
  my $min_version = delete $args{min_version};
- defined and not ref and $_ = $build_version->($_) for $min_version;
+ defined and not ref and $_ = version->new($_) for $min_version;
 
  my ($valgrind, $version);
  for (@paths) {
@@ -111,7 +104,7 @@ sub new {
   my $ver = qx/$_ --version/;
   if ($ver =~ /^valgrind-(\d+(\.\d+)*)/) {
    if ($min_version) {
-    $version = $build_version->($1);
+    $version = version->new($1);
     next if $version < $min_version;
    } else {
     $version = $1;
@@ -149,7 +142,7 @@ sub version {
  my ($self) = @_;
 
  my $version = $self->{version};
- $self->{version} = $version = $build_version->($version) unless ref $version;
+ $self->{version} = $version = version->new($version) unless ref $version;
 
  return $version;
 }