From: Vincent Pit Date: Fri, 13 Mar 2015 15:17:44 +0000 (-0300) Subject: Update VPIT::TestHelpers to 3c878c7c X-Git-Tag: v0.07~1 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=4e67a9de485923befcb9fab8a9e13f3ccc4f47d8;p=perl%2Fmodules%2FAcme-CPANAuthors-You-re_using.git Update VPIT::TestHelpers to 3c878c7c --- diff --git a/t/lib/VPIT/TestHelpers.pm b/t/lib/VPIT/TestHelpers.pm index 3d545e8..c147f80 100644 --- a/t/lib/VPIT/TestHelpers.pm +++ b/t/lib/VPIT/TestHelpers.pm @@ -3,9 +3,12 @@ package VPIT::TestHelpers; use strict; use warnings; +use Config (); + my %exports = ( load_or_skip => \&load_or_skip, load_or_skip_all => \&load_or_skip_all, + run_perl => \&run_perl, skip_all => \&skip_all, ); @@ -102,6 +105,21 @@ sub load_or_skip_all { return $loaded; } +sub run_perl { + my $code = shift; + + my ($SystemRoot, $PATH) = @ENV{qw}; + my $ld_name = $Config::Config{ldlibpthname}; + my $ldlibpth = $ENV{$ld_name}; + + local %ENV; + $ENV{$ld_name} = $ldlibpth if defined $ldlibpth; + $ENV{SystemRoot} = $SystemRoot if $^O eq 'MSWin32' and defined $SystemRoot; + $ENV{PATH} = $PATH if $^O eq 'cygwin' and defined $PATH; + + system { $^X } $^X, '-T', map("-I$_", @INC), '-e', $code; +} + package VPIT::TestHelpers::Guard; sub new {