This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
new perldelta
[perl5.git] / t / mro / isa_aliases.t
CommitLineData
e1603486
FC
1#!./perl
2
624c42e2
N
3BEGIN {
4 chdir 't' if -d 't';
5 require './test.pl';
6 set_up_inc('../lib');
7}
e1603486 8
6e1b2de7 9plan 13;
e1603486
FC
10
11@Foogh::ISA = "Bar";
12*Phoogh::ISA = *Foogh::ISA;
13@Foogh::ISA = "Baz";
14
15ok 'Foogh'->isa("Baz"),
16 'isa after another stash has claimed the @ISA via glob assignment';
17ok 'Phoogh'->isa("Baz"),
18 'isa on the stash that claimed the @ISA via glob assignment';
19ok !Foogh->isa("Bar"),
20 '!isa when another stash has claimed the @ISA via glob assignment';
21ok !Phoogh->isa("Bar"),
22 '!isa on the stash that claimed the @ISA via glob assignment';
23
a5dba54a
FC
24@Foogh::ISA = "Bar";
25*Foogh::ISA = ["Baz"];
26
27ok 'Foogh'->isa("Baz"),
28 'isa after glob-to-ref assignment when *ISA is shared';
29ok 'Phoogh'->isa("Baz"),
30 'isa after glob-to-ref assignment on another stash when *ISA is shared';
31ok !Foogh->isa("Bar"),
32 '!isa after glob-to-ref assignment when *ISA is shared';
33ok !Phoogh->isa("Bar"),
34 '!isa after glob-to-ref assignment on another stash when *ISA is shared';
35
e1603486
FC
36@Foo::ISA = "Bar";
37*Phoo::ISA = \@Foo::ISA;
38@Foo::ISA = "Baz";
39
40ok 'Foo'->isa("Baz"),
41 'isa after another stash has claimed the @ISA via ref-to-glob assignment';
42ok 'Phoo'->isa("Baz"),
43 'isa on the stash that claimed the @ISA via ref-to-glob assignment';
44ok !Foo->isa("Bar"),
45 '!isa when another stash has claimed the @ISA via ref-to-glob assignment';
46ok !Phoo->isa("Bar"),
47 '!isa on the stash that claimed the @ISA via ref-to-glob assignment';
6e1b2de7
FC
48
49*Fooo::ISA = *Baro::ISA;
50@Fooo::ISA = "Bazo";
51sub Bazo::ook { "Baz" }
52sub L::ook { "See" }
53Baro->ook;
54local *Fooo::ISA = ["L"];
55is 'Baro'->ook, 'See', 'localised *ISA=$ref assignment';