Search code examples
perlmoose

"default naming conventions" moose perl


In the moose manual it gives examples on how to change the accessor names e.g.

reader => get_myvariable,
writer => set_myvariable,

and then it states:

If you're thinking that doing this over and over would be insanely tedious, you're right! Fortunately, Moose provides a powerful extension system that lets you override the default naming conventions. See Moose::Manual::MooseX for more details.

I was browsing through the MooseX manual but couldn't locate the documentation on this. Is anyone familiar with this and could point me to the right part of the manual?


Solution

  • That line is referring to the following section of the MooseX page: https://metacpan.org/pod/distribution/Moose/lib/Moose/Manual/MooseX.pod#MooseX::FollowPBP. (Note that the next section on MooseX::SemiAffordanceAccessor has an alternative option.)

    Essentially, all you need to do is add use MooseX::FollowPBP to your imports.

    See the actual module's documentation for more information: https://metacpan.org/pod/MooseX::FollowPBP