1

It appears that Moose 'has' attribute requires the option 'is'. It goes gaga if I omit it.

Practically every number or string attribute I declare will be 'rw'.

How can I set a default for 'is' so I don't have to write it every time?

I checked out Moose::Meta::Attribute::Native, but if it tells me how to do that, I'm too stupid to understand it.

user1067305
  • 3,233
  • 7
  • 24
  • 29

1 Answers1

1

You could use the MooseX::HasDefaults module.

It gives you two options, either set the default to 'ro' or to 'rw':

use Moose;
use MooseX::HasDefaults::RW;

has 'thing' => (
  isa  => 'Str'
);

The above code creates an attribute 'thing' which is 'rw' by default.

A Gold Man
  • 198
  • 2
  • 7