Commit | Line | Data |
---|---|---|
9ebf26ad FR |
1 | #!./perl |
2 | ||
3 | use strict; | |
4 | use warnings; | |
5 | ||
6 | # Test ${^GLOBAL_PHASE} | |
7 | # | |
8e7b2370 JK |
8 | # Test::More, t/test.pl, etc., assert plans in END, which happens before global |
9 | # destruction. We do not want to use those programs/libraries here, so we | |
10 | # place this file in directory t/opbasic. | |
9ebf26ad FR |
11 | |
12 | BEGIN { print "1..7\n" } | |
13 | ||
14 | sub ok ($$) { | |
15 | print "not " if !$_[0]; | |
16 | print "ok"; | |
17 | print " - $_[1]" if defined $_[1]; | |
18 | print "\n"; | |
19 | } | |
20 | ||
21 | BEGIN { | |
22 | ok ${^GLOBAL_PHASE} eq 'START', 'START'; | |
23 | } | |
24 | ||
25 | CHECK { | |
26 | ok ${^GLOBAL_PHASE} eq 'CHECK', 'CHECK'; | |
27 | } | |
28 | ||
29 | INIT { | |
30 | ok ${^GLOBAL_PHASE} eq 'INIT', 'INIT'; | |
31 | } | |
32 | ||
33 | ok ${^GLOBAL_PHASE} eq 'RUN', 'RUN'; | |
34 | ||
35 | sub Moo::DESTROY { | |
36 | ok ${^GLOBAL_PHASE} eq 'RUN', 'DESTROY is run-time too, usually'; | |
37 | } | |
38 | ||
39 | my $tiger = bless {}, Moo::; | |
40 | ||
41 | sub Kooh::DESTROY { | |
42 | ok ${^GLOBAL_PHASE} eq 'DESTRUCT', 'DESTRUCT'; | |
43 | } | |
44 | ||
45 | our $affe = bless {}, Kooh::; | |
46 | ||
47 | END { | |
48 | ok ${^GLOBAL_PHASE} eq 'END', 'END'; | |
49 | } |