1 package Method::Generate::DemolishAll;
4 use base qw(Moo::Object);
10 my ($self, $into) = @_;
11 quote_sub "${into}::DEMOLISHALL", join '',
12 $self->_handle_subdemolish($into),
13 qq{ my \$self = shift;\n},
14 $self->demolishall_body_for($into, '$self', '@_'),
18 sub demolishall_body_for {
19 my ($self, $into, $me, $args) = @_;
21 grep *{_getglob($_)}{CODE},
23 @{Moo::_Utils::_get_linear_isa($into)};
24 join '', map qq{ ${me}->${_}(${args});\n}, @demolishers;
27 sub _handle_subdemolish {
28 my ($self, $into) = @_;
29 ' if (ref($_[0]) ne '.perlstring($into).') {'."\n".
30 ' return shift->Moo::Object::DEMOLISHALL(@_)'.";\n".