12 unless (exists $NO_DEMOLISH{$class}) {
13 unless ($NO_DEMOLISH{$class} = !$class->can('DEMOLISH')) {
14 ($DEMOLISH_MAKER ||= do {
15 require Method::Generate::DemolishAll;
16 Method::Generate::DemolishAll->new
17 })->generate_method($class);
21 return bless({ ref($_[0]) eq 'HASH' ? %{$_[0]} : @_ }, $class);
22 $NO_BUILD{$class} = !$class->can('BUILD') unless exists $NO_BUILD{$class};
24 ? bless({ ref($_[0]) eq 'HASH' ? %{$_[0]} : @_ }, $class)
26 my $proto = ref($_[0]) eq 'HASH' ? $_[0] : { @_ };
27 bless({ %$proto }, $class)->BUILDALL($proto);
31 # Inlined into Method::Generate::Constructor::_generate_args() - keep in sync
34 if ( scalar @_ == 1 ) {
35 unless ( defined $_[0] && ref $_[0] eq 'HASH' ) {
36 die "Single parameters to new() must be a HASH ref"
37 ." data => ". $_[0] ."\n";
39 return { %{ $_[0] } };
42 die "The new() method for $class expects a hash reference or a key/value list."
43 . " You passed an odd number of arguments\n";
52 $self->${\(($BUILD_MAKER ||= do {
53 require Method::Generate::BuildAll;
54 Method::Generate::BuildAll->new
55 })->generate_method(ref($self)))}(@_);
60 $self->${\(($DEMOLISH_MAKER ||= do {
61 require Method::Generate::DemolishAll;
62 Method::Generate::DemolishAll->new
63 })->generate_method(ref($self)))}(@_);
68 { no warnings 'redefine'; *does = \&Role::Tiny::does_role }
69 goto &Role::Tiny::does_role;
72 # duplicated in Moo::Role
74 require Moo::HandleMoose::FakeMetaClass;
75 my $class = ref($_[0])||$_[0];
76 bless({ name => $class }, 'Moo::HandleMoose::FakeMetaClass');