]> git.vpit.fr Git - perl/modules/Test-Valgrind.git/commitdiff
Make sure File::Temp is recent enough for ->newdir
authorVincent Pit <perl@profvince.com>
Sun, 15 Nov 2015 19:03:22 +0000 (17:03 -0200)
committerVincent Pit <perl@profvince.com>
Sun, 15 Nov 2015 19:03:31 +0000 (17:03 -0200)
Spotted by Paul Howarth.

Makefile.PL
t/lib/Test/Valgrind/FakeValgrind.pm

index f716fe24c1d96b641ea3af6cc928b0b899bdafcd..cd4b76283940ea2ada6154f4548b45f9208c24b1 100644 (file)
@@ -127,7 +127,7 @@ my %PREREQ_PM = (
  'File::HomeDir'         => '0.86',
  'File::Path'            => 0,
  'File::Spec'            => 0,
- 'File::Temp'            => '0.14', # OO interface
+ 'File::Temp'            => '0.19', # ->newdir in tests
  'Filter::Util::Call'    => 0,
  'Fcntl'                 => 0,
  'IO::Select'            => 0,
@@ -150,7 +150,7 @@ my %CONFIGURE_REQUIRES = (
 
 my %BUILD_REQUIRES = (
  %CONFIGURE_REQUIRES,
- 'File::Temp'          => 0,
+ 'File::Temp'          => '0.19', # ->newdir in tests
  'IO::Handle'          => 0,
  'IO::Select'          => 0,
  'IPC::Open3'          => 0,
index 3f61ba6c32f05d87321ccd0e7589bc47b509905d..067309b6a5cd708f0b04a8fc064673ffbe49740b 100644 (file)
@@ -33,6 +33,15 @@ if (\@ARGV == 1 && \$ARGV[0] eq '--version') {
  FAKE_VG
 }
 
+my $good_enough_file_temp;
+BEGIN {
+ $good_enough_file_temp = do {
+  no warnings;
+  local $@;
+  eval { File::Temp->VERSION('0.19'); 1 }
+ }
+}
+
 sub new {
  my ($class, %args) = @_;
 
@@ -43,6 +52,8 @@ sub new {
  my $self = { };
 
  if (defined $exe_name) {
+  return 'File::Temp 0.19 is required to make a proper temporary directory'
+         unless $good_enough_file_temp;
   $self->{tmp_dir_obj}  = File::Temp->newdir(CLEANUP => 1);
   $self->{tmp_dir}      = $self->{tmp_dir_obj}->dirname;
   $self->{tmp_file}     = File::Spec->catfile($self->{tmp_dir}, $exe_name);