package Cls;
use Moose;
has an_array => (
traits => ['Array'],
isa => 'ArrayRef[Str]',
is => 'rw',
# !!! forgotten default to empty array
handles => {
list_array => 'elements',
add_item => 'push',
},
);
package main;
func();
sub func {
my $c = Cls->new();
$c->add_item('String');
}
####
package MooseX::Silent;
use Carp qw(confess);
$Carp::Internal{$_}++ for qw{
MooseX::Silent
MooseX::Method::Signatures::Meta::Method
Moose::Meta::Attribute::Native::MethodProvider::Hash
Moose::Meta::Attribute::Native::MethodProvider::Array
Moose::Meta::Attribute::Native::Trait
};
$SIG{'__DIE__'} = sub {
my $msg = shift;
for($msg) {
s/^.*Internal Validation Error is: //;
s/MooseX::Types::Structured:://g;
s/ at .*? line \d*\.//;
chomp;
}
confess "$msg";
};
1;
####
Can't use an undefined value as an ARRAY reference at tst.pl line 22
main::func() called at tst.pl line 18