return $loaded;
}
-sub run_perl {
- my $code = shift;
-
- if ($code =~ /"/) {
- die 'Double quotes in evaluated code are not portable';
- }
+sub fresh_perl_env (&) {
+ my $handler = shift;
my ($SystemRoot, $PATH) = @ENV{qw<SystemRoot PATH>};
my $ld_name = $Config::Config{ldlibpthname};
}
}
- system { $perl } $perl, '-T', map("-I$_", @INC), '-e', $code;
+ return $handler->($perl, '-T', map("-I$_", @INC));
+}
+
+sub run_perl {
+ my $code = shift;
+
+ if ($code =~ /"/) {
+ die 'Double quotes in evaluated code are not portable';
+ }
+
+ fresh_perl_env {
+ my ($perl, @perl_args) = @_;
+ system { $perl } $perl, @perl_args, '-e', $code;
+ };
}
sub init_capture {