BEGIN {
chdir 't' if -d 't';
- @INC = '../lib';
require './test.pl';
+ set_up_inc('../lib');
}
use Config;
"don't copy a stale lexical; create a fresh undef one instead");
}
-# [perl #63540] Don’t treat sub { if(){.....}; "constant" } as a constant
-
-BEGIN {
- my $x = 7;
- *baz = sub() { if($x){ () = "tralala"; blonk() }; 0 }
-}
-{
- my $blonk_was_called;
- *blonk = sub { ++$blonk_was_called };
- my $ret = baz();
- is($ret, 0, 'RT #63540');
- is($blonk_was_called, 1, 'RT #63540');
-}
-
# test PL_cv_has_eval. Any anon sub that could conceivably contain an
# eval, should be marked as cloneable
};
};
$s1->();
- undef &$s1; # frees $s2’s prototype, causing the $s3 proto to have its
+ undef &$s1; # frees $s2's prototype, causing the $s3 proto to have its
# CvOUTSIDE point to $s1
::is $s2->()(), 3, 'cloning closure proto whose CvOUTSIDE has changed';
}
'closures in source filters do not interfere with pad names';
}
+sub {
+ my $f;
+ sub test_ref_to_unavailable {
+ my $ref = \$f;
+ $$ref = 7;
+ is $f, 7, 'taking a ref to unavailable var should not copy it';
+ }
+};
+test_ref_to_unavailable();
+
done_testing();