summaryrefslogtreecommitdiffstats
path: root/gnu/usr.bin/perl/t/op/closure_test.pl
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/usr.bin/perl/t/op/closure_test.pl')
-rw-r--r--gnu/usr.bin/perl/t/op/closure_test.pl10
1 files changed, 10 insertions, 0 deletions
diff --git a/gnu/usr.bin/perl/t/op/closure_test.pl b/gnu/usr.bin/perl/t/op/closure_test.pl
new file mode 100644
index 00000000000..c06250d975f
--- /dev/null
+++ b/gnu/usr.bin/perl/t/op/closure_test.pl
@@ -0,0 +1,10 @@
+# This file exists to test closure prototypes with no CvOUTSIDE. Only
+# by putting this in a separate file can we get a sub (this file’s
+# main CV) with no CvOUTSIDE. When the outer sub is freed, the inner
+# subs also get CvOUTSIDE set to null.
+
+ my $x;
+ $closure_test::s2 = sub {
+ $x;
+ sub { $x; '10 cubes' };
+ };