1 package Method::Generate::BuildAll;
4 use base qw(Moo::Object);
10 my ($self, $into) = @_;
11 quote_sub "${into}::BUILDALL", join '',
12 $self->_handle_subbuild($into),
13 qq{ my \$self = shift;\n},
14 $self->buildall_body_for($into, '$self', '@_'),
18 sub _handle_subbuild {
19 my ($self, $into) = @_;
20 ' if (ref($_[0]) ne '.perlstring($into).') {'."\n".
21 ' return shift->Moo::Object::BUILDALL(@_)'.";\n".
25 sub buildall_body_for {
26 my ($self, $into, $me, $args) = @_;
28 grep *{_getglob($_)}{CODE},
30 reverse @{Moo::_Utils::_get_linear_isa($into)};
31 join '', map qq{ ${me}->${_}(${args});\n}, @builds;