13 return bless({ ref($_[0]) eq 'HASH' ? %{$_[0]} : @_ }, $class);
14 $NO_BUILD{$class} = !$class->can('BUILD') unless exists $NO_BUILD{$class};
16 ? bless({ ref($_[0]) eq 'HASH' ? %{$_[0]} : @_ }, $class)
18 my $proto = ref($_[0]) eq 'HASH' ? $_[0] : { @_ };
19 bless({ %$proto }, $class)->BUILDALL($proto);
23 # Inlined into Method::Generate::Constructor::_generate_args() - keep in sync
26 if ( scalar @_ == 1 ) {
27 unless ( defined $_[0] && ref $_[0] eq 'HASH' ) {
28 die "Single parameters to new() must be a HASH ref"
29 ." data => ". $_[0] ."\n";
31 return { %{ $_[0] } };
34 die "The new() method for $class expects a hash reference or a key/value list."
35 . " You passed an odd number of arguments\n";
44 $self->${\(($BUILD_MAKER ||= do {
45 { local $@; require Method::Generate::BuildAll; }
46 Method::Generate::BuildAll->new
47 })->generate_method(ref($self)))}(@_);
52 $self->${\(($DEMOLISH_MAKER ||= do {
53 { local $@; require Method::Generate::DemolishAll; }
54 Method::Generate::DemolishAll->new
55 })->generate_method(ref($self)))}(@_);
61 my $class = ref($self);
63 $NO_DEMOLISH{$class} = !$class->can('DEMOLISH')
64 unless exists $NO_DEMOLISH{$class};
66 return if $NO_DEMOLISH{$class};
73 $self->DEMOLISHALL($Moo::_Utils::_in_global_destruction);
79 die $e if $e; # rethrow
83 { local $@; require Role::Tiny; }
84 { no warnings 'redefine'; *does = \&Role::Tiny::does_role }
85 goto &Role::Tiny::does_role;