33 my $expect = ":" . join(":", @expect);
35 fresh_perl_is(<<'SCRIPT', $expect,{switches => [''], stdin => '', stderr => 1 },'Order of execution of special blocks');
40 BEGIN {BEGIN {print ":b3"}; print ":b4"}
44 UNITCHECK {print ":u1"}
45 eval 'BEGIN {print ":b5"}';
46 eval 'UNITCHECK {print ":u2"}';
47 eval 'UNITCHECK {print ":u3"; UNITCHECK {print ":u4"}}';
48 "a" =~ /(?{UNITCHECK {print ":u5"};
50 BEGIN {print ":b6"}})/x;
51 eval {BEGIN {print ":b7"}};
52 eval {UNITCHECK {print ":u6"}};
53 eval {INIT {print ":i2"}};
54 eval {CHECK {print ":c3"}};
60 qw( main bar myfoo foo ),
62 qw( foo myfoo bar main ),
64 qw( foo myfoo bar main ),
66 qw( main bar myfoo foo ),
68 qw(foo myfoo bar main ));
70 $expect = ":" . join(":", @expect);
71 fresh_perl_is(<<'SCRIPT2', $expect,{switches => [''], stdin => '', stderr => 1 },'blocks interact with packages/scopes');
72 BEGIN {$f = 'main'; print ":$f"}
73 UNITCHECK {print ":$f"}
78 BEGIN {$f = 'bar';print ":$f"}
79 UNITCHECK {print ":$f"}
86 BEGIN {$f = 'myfoo'; print ":$f"}
87 UNITCHECK {print ":$f"}
92 BEGIN {$f = "foo";print ":$f"}
93 UNITCHECK {print ":$f"}
99 @expect = qw(begin unitcheck check init end);
100 $expect = ":" . join(":", @expect);
101 fresh_perl_is(<<'SCRIPT3', $expect,{switches => [''], stdin => '', stderr => 1 },'can name blocks as sub FOO');
102 sub BEGIN {print ":begin"}
103 sub UNITCHECK {print ":unitcheck"}
104 sub CHECK {print ":check"}
105 sub INIT {print ":init"}
106 sub END {print ":end"}