1611 shaares
17 private links
17 private links
2 results
tagged
attributes
Use the init_arg
attribute configuration (see "Constructor parameters" in Moose::Manual::Attributes):
package SOD::KuuAnalyze::ProdId;
use Moose;
has 'users' => (
isa => 'ArrayRef[Str]', is => "ro",
init_arg => undef, # do not allow in constructor
);
1;
package Foo {
use Moo;
has a => (is => "ro");
has b => (is => "ro");
}
my $bar = Foo->new(a => 42);
# Print only 'a'
say $_ for keys %{ $bar }
# Print all attributes
say $_ for keys( %{
'Moo'->_constructor_maker_for('Foo')->all_attribute_specs
});