#!./perl
#
# Tests for Perl run-time environment variable settings
#
# $PERL5OPT, $PERL5LIB, etc.
BEGIN {
chdir 't' if -d 't';
print "1..0 # Skip: no fork\n";
exit 0;
}
}
use Test;
my $STDOUT = './results-0';
my $STDERR = './results-1';
my $PERL = './perl';
my $FAILURE_CODE = 119;
# Run perl with specified environment and arguments returns a list.
# First element is true if Perl's stdout and stderr match the
# supplied $stdout and $stderr argument strings exactly.
# second element is an explanation of the failure
local *F;
wait;
{ local $/; $actual_stdout = <F> }
{ local $/; $actual_stderr = <F> }
} else {
return 1; # success
}
} else { # child
}
}
}
sub it_didnt_work {
exit $FAILURE_CODE;
}
sub try {
}
# PERL5OPT Command-line options (switches). Switches in
# this variable are taken as if they were on
# every Perl command line. Only the -[DIMUdmtw]
# switches are allowed. When running taint
# checks (because the program was running setuid
# or setgid, or the -T switch was used), this
# variable is ignored. If PERL5OPT begins with
# -T, tainting will be enabled, and any
# subsequent options ignored.
"",
qq{Name "main::x" used only once: possible typo at -e line 1.\nUse of uninitialized value in print at -e line 1.\n});
"", "");
"",
qq{Global symbol "\$x" requires explicit package name at -e line 1.\nExecution of -e aborted due to compilation errors.\n});
# Fails in 5.6.0
"",
qq{Global symbol "\$x" requires explicit package name at -e line 1.\nExecution of -e aborted due to compilation errors.\n});
# Fails in 5.6.0
"",
<<ERROR
Name "main::x" used only once: possible typo at -e line 1.
Use of uninitialized value in print at -e line 1.
ERROR
);
# Fails in 5.6.0
"",
<<ERROR
Name "main::x" used only once: possible typo at -e line 1.
Use of uninitialized value in print at -e line 1.
ERROR
);
"",
"");
# Fails in 5.6.0
"",
"");
"ok",
"");
['-e', 'print $ENV{PERL5OPT}'],
'-w -w',
'');
['-e', 'print ${^TAINT}'],
'-1',
'');
['-e', 'print grep { $_ eq "foobar" } @INC'],
'foobar',
'');
['-e', 'print grep { $_ eq "42" } @INC'],
'42',
'');
['-e', 'print grep { $_ eq "foobar" } @INC'],
'foobar',
'');
['-e', 'print grep { $_ eq "42" } @INC'],
'42',
'');
['-e', 'print grep { $_ eq "foo" } @INC'],
'foo',
'');
['-e', 'print grep { $_ eq "bar" } @INC'],
'',
'');
# PERL5LIB tests with included arch directories still missing
END {
}