if (CvUNIQUE(sv)) sv_catpv(d, "UNIQUE,");
if (CvCLONE(sv)) sv_catpv(d, "CLONE,");
if (CvCLONED(sv)) sv_catpv(d, "CLONED,");
+ if (CvCONST(sv)) sv_catpv(d, "CONST,");
if (CvNODEBUG(sv)) sv_catpv(d, "NODEBUG,");
if (SvCOMPILED(sv)) sv_catpv(d, "COMPILED,");
break;
# skip leavesub
return $proto . "{\n\t" .
$self->deparse($cv->ROOT->first, 0) . "\n\b}\n";
+ }
+ my $sv = $cv->const_sv;
+ if ($$sv) {
+ # uh-oh. inlinable sub... format it differently
+ return $proto . "{ " . const($sv) . " }\n";
} else { # XSUB?
return $proto . "{}\n";
}
use strict;
use Config;
-print "1..13\n";
+print "1..15\n";
my $test = 1;
ok;
}
+print "not " if (eval "sub ".$deparse->coderef2text(sub () { 42 }))->() != 42;
+ok;
+
+use constant 'c', 'stuff';
+print "not " if (eval "sub ".$deparse->coderef2text(\&c))->() ne 'stuff';
+ok;
+
+# XXX ToDo - constsub that returns a reference
+#use constant cr => ['hello'];
+#my $string = "sub " . $deparse->coderef2text(\&cr);
+#my $val = (eval $string)->();
+#print "not " if ref($val) ne 'ARRAY' || $val->[0] ne 'hello';
+#ok;
+
my $a;
my $Is_VMS = $^O eq 'VMS';
$a = `$^X "-I../lib" "-MO=Deparse" -anle 1 2>&1`;
print "# [$a]\n\# vs\n# [$b]\nnot " if $a ne $b;
ok;
-#6
$a = `$^X "-I../lib" "-MO=Debug" -e 1 2>&1`;
print "not " unless $a =~
/\bLISTOP\b.*\bOP\b.*\bCOP\b.*\bOP\b/s;
ok;
-#7
$a = `$^X "-I../lib" "-MO=Terse" -e 1 2>&1`;
print "not " unless $a =~
/\bLISTOP\b.*leave.*\bOP\b.*enter.*\bCOP\b.*nextstate.*\bOP\b.*null/s;