sub _build__final_class {
my ($self) = @_;
+
+ # This path will only be taken if class => undef was intentionally passed
+ # to our constructor; this allows for a subref constructor which of course
+ # doesn't necessarily need a class at all.
+
+ return unless defined($self->class);
+
my $class = use_module($self->class);
if (my @roles = $self->_role_list) {
require Moo::Role;
# [ $x ] -> $x
# [ $inv, 'x', 'y' ] -> $inv->x->y
- # [ $inv, [ 'x', 'y' ], 'z' ] -> $inv->x('y')->z
+ # [ $inv, [ 'x', [ 'y' ] ], 'z' ] -> $inv->x('y')->z
+ # [ $inv, [ 'x', [ $other, 'y' ] ], 'z' ] -> $inv->x($other->y)->z
+
+ no warnings 'once'; # $a
return reduce {
my ($meth, @arg) = (ref($b) eq 'ARRAY' ? @$b : $b);
- $a->$meth(@arg);
+ $a->$meth(map $self->_resolve($_), @arg);
} @$to_resolve;
}
sub BUILD {
my ($self, $args) = @_;
unless (
- $args->{object} or $args->{class}
- or ($self->can('_build_class') ne __PACKAGE__->can('_build_class')
+ $args->{object} or exists $args->{class}
+ or ($self->can('_build_class') ne __PACKAGE__->can('_build_class'))
) {
die "No static object passed, and no class supplied or defaulted";
}