use Config;
-print "1..169\n";
+print "1..171\n";
my $test = 1;
sub test (&) {
&{$foo[4]}(4)
};
+for my $n (0..4) {
+ $foo[$n] = sub {
+ # no intervening reference to $n here
+ sub { $n == $_[0] }
+ };
+}
+
+test {
+ $foo[0]->()->(0) and
+ $foo[1]->()->(1) and
+ $foo[2]->()->(2) and
+ $foo[3]->()->(3) and
+ $foo[4]->()->(4)
+};
+
+{
+ my $w;
+ $w = sub {
+ my ($i) = @_;
+ test { $i == 10 };
+ sub { $w };
+ };
+ $w->(10);
+}
+
# Additional tests by Tom Phoenix <rootbeer@teleport.com>.
{
$test++;
}
- if ($Config{d_fork} and $^O ne 'VMS' and $^O ne 'MSWin32') {
+ if ($Config{d_fork} and $^O ne 'VMS' and $^O ne 'MSWin32' and $^O ne 'NetWare') {
# Fork off a new perl to run the tests.
# (This is so we can catch spurious warnings.)
$| = 1; print ""; $| = 0; # flush output before forking
open CMD, ">$cmdfile"; print CMD $code; close CMD;
my $cmd = (($^O eq 'VMS') ? "MCR $^X"
: ($^O eq 'MSWin32') ? '.\perl'
+ : ($^O eq 'MacOS') ? $^X
+ : ($^O eq 'NetWare') ? 'perl'
: './perl');
$cmd .= " -w $cmdfile 2>$errfile";
- if ($^O eq 'VMS' or $^O eq 'MSWin32') {
+ if ($^O eq 'VMS' or $^O eq 'MSWin32' or $^O eq 'NetWare') {
# Use pipe instead of system so we don't inherit STD* from
# this process, and then foul our pipe back to parent by
# redirecting output in the child.