2 my $keep_plc = 0; # set it to keep the bytecode files
3 my $keep_plc_fail = 1; # set it to keep the bytecode files on failures
7 print "1..0 # skip - Bytecode/ByteLoader doesn't work on VMS\n";
13 if ($Config{ccflags} =~ /-DPERL_COPY_ON_WRITE/) {
14 print "1..0 # skip - no COW for now\n";
17 require './test.pl'; # for run_perl()
22 my @tests = split /\n###+\n/, <DATA>;
24 print "1..".($#tests+1)."\n";
31 my ($script, $expect) = split />>>+\n/;
33 $test = "bytecode$cnt.pl";
34 open T, ">$test"; print T $script; close T;
35 $got = run_perl(switches => [ "-MO=Bytecode,-H,-o${test}c" ],
36 verbose => 0, # for debugging
37 stderr => 1, # to capture the "bytecode.pl syntax ok"
40 $got = run_perl(progfile => "${test}c"); # run the .plc
42 if ($got =~ /^$expect$/) {
46 $keep_plc = $keep_plc_fail unless $keep_plc;
68 1 while unlink($test, $keep_plc ? () : "${test}c");
77 ############################################################
78 for (1,2,3) { print if /\d/ }
81 ############################################################
82 $_ = "xyxyx"; %j=(1,2); s/x/$j{print('z')}/ge; print $_
85 ############################################################
86 $_ = "xyxyx"; %j=(1,2); s/x/$j{print('z')}/g; print $_
89 ############################################################
90 split /a/,"bananarama"; print @_
93 ############################################################
94 { package P; sub x { print 'ya' } x }
97 ############################################################
98 @z = split /:/,"b:r:n:f:g"; print @z
101 ############################################################
102 sub AUTOLOAD { print 1 } &{"a"}()
105 ############################################################
106 my $l = 3; $x = sub { print $l }; &$x
109 ############################################################
111 my $foo = sub {$i = shift if @_};
113 ############################################################
114 $x="Cannot use"; print index $x, "Can"
117 ############################################################
118 my $i=6; eval "print \$i\n"
121 ############################################################
122 BEGIN { %h=(1=>2,3=>4) } print $h{3}
125 ############################################################
127 ############################################################
135 ############################################################
136 BEGIN { tie @a, __PACKAGE__; sub TIEARRAY { bless{} } sub FETCH { 1 } }
140 ############################################################
141 my $i=3; print 1 .. $i
144 ############################################################
145 my $h = { a=>3, b=>1 }; print sort {$h->{$a} <=> $h->{$b}} keys %$h
148 ############################################################
149 print sort { my $p; $b <=> $a } 1,4,3