5 package t::non_moo_strict;
8 my ($class, $arg) = @_;
9 die "invalid arguments: " . join(',', @_[2..$#_])
11 bless { attr => $arg }, $class;
14 sub attr { shift->{attr} }
16 package t::ext_non_moo_strict::with_attr;
18 extends qw( t::non_moo_strict );
20 has 'attr2' => ( is => 'ro' );
22 sub FOREIGNBUILDARGS {
23 my ($class, %args) = @_;
27 package t::ext_non_moo_strict::without_attr;
29 extends qw( t::non_moo_strict );
31 sub FOREIGNBUILDARGS {
32 my ($class, %args) = @_;
38 my $non_moo = t::non_moo_strict->new( 'bar' );
39 my $ext_non_moo = t::ext_non_moo_strict::with_attr->new( attr => 'bar', attr2 => 'baz' );
40 my $ext_non_moo2 = t::ext_non_moo_strict::without_attr->new( attr => 'bar', attr2 => 'baz' );
42 is $non_moo->attr, 'bar',
43 "non-moo accepts params";
44 is $ext_non_moo->attr, 'bar',
45 "extended non-moo passes params";
46 is $ext_non_moo->attr2, 'baz',
47 "extended non-moo has own attributes";
48 is $ext_non_moo2->attr, 'baz',
49 "extended non-moo passes params";