This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Revert "[perl #77688] tie $scalar can tie a handle"
[perl5.git] / t / op / magic_phase.t
CommitLineData
9ebf26ad
FR
1#!./perl
2
3use strict;
4use warnings;
5
6# Test ${^GLOBAL_PHASE}
7#
8# Test::More, test.pl, etc assert plans in END, which happens before global
9# destruction, so we don't want to use those here.
10
11BEGIN { print "1..7\n" }
12
13sub ok ($$) {
14 print "not " if !$_[0];
15 print "ok";
16 print " - $_[1]" if defined $_[1];
17 print "\n";
18}
19
20BEGIN {
21 ok ${^GLOBAL_PHASE} eq 'START', 'START';
22}
23
24CHECK {
25 ok ${^GLOBAL_PHASE} eq 'CHECK', 'CHECK';
26}
27
28INIT {
29 ok ${^GLOBAL_PHASE} eq 'INIT', 'INIT';
30}
31
32ok ${^GLOBAL_PHASE} eq 'RUN', 'RUN';
33
34sub Moo::DESTROY {
35 ok ${^GLOBAL_PHASE} eq 'RUN', 'DESTROY is run-time too, usually';
36}
37
38my $tiger = bless {}, Moo::;
39
40sub Kooh::DESTROY {
41 ok ${^GLOBAL_PHASE} eq 'DESTRUCT', 'DESTRUCT';
42}
43
44our $affe = bless {}, Kooh::;
45
46END {
47 ok ${^GLOBAL_PHASE} eq 'END', 'END';
48}