+ - ignore required when default or builder is present
- document Moo versus Any::Moose in brief with article link
- remove quote_sub from SYNOPSIS and has docs, expand Sub::Quote section
- localize @_ when inlining quote_sub'ed isa checks (fixes lazy+isa+default)
my ($self, $spec) = @_;
my @required_init =
map $spec->{$_}{init_arg},
- grep $spec->{$_}{required},
- sort keys %$spec;
+ grep {
+ my %s = %{$spec->{$_}}; # ignore required if default or builder set
+ $s{required} and not($s{builder} or $s{default})
+ } sort keys %$spec;
return '' unless @required_init;
' if (my @missing = grep !exists $args->{$_}, qw('
.join(' ',@required_init).')) {'."\n"
has five => (is => 'ro', init_arg => undef, default => sub { {} });
has six => (is => 'ro', builder => 1);
sub _build_six { {} }
+ has seven => (is => 'ro', required => 1, default => quote_sub q{ {} });
}
sub check {
check six => map Foo->new->{six}, 1..2;
+check seven => map Foo->new->{seven}, 1..2;
+
done_testing;