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 :  /usr/share/doc/perl-Moose/t/metaclasses/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/share/doc/perl-Moose/t/metaclasses/use_base_of_moose.t
use strict;
use warnings;

use Test::More;

{
    package NoOpTrait;
    use Moose::Role;
}

{
    package Parent;
    use Moose -traits => 'NoOpTrait';

    has attr => (
        is  => 'rw',
        isa => 'Str',
    );
}

{
    package Child;
    use parent -norequire => 'Parent';
}

is(Child->meta->name, 'Child', "correct metaclass name");

my $child = Child->new(attr => "ibute");
ok($child, "constructor works");

is($child->attr, "ibute", "getter inherited properly");

$child->attr("ition");
is($child->attr, "ition", "setter inherited properly");

done_testing;

Hry