"default naming conventions" 驼鹿 perl

"default naming conventions" moose perl

在 moose 手册中,它给出了如何更改访问器名称的示例,例如

reader => get_myvariable,
writer => set_myvariable,

然后它说:

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.

我正在浏览 MooseX 手册,但找不到相关文档。有没有人熟悉这一点并能指出手册的正确部分?

该行指的是 MooseX 页面的以下部分:https://metacpan.org/pod/distribution/Moose/lib/Moose/Manual/MooseX.pod#MooseX::FollowPBP。 (请注意 MooseX::SemiAffordanceAccessor 的下一节有一个替代选项。)

基本上,您需要做的就是将 use MooseX::FollowPBP 添加到您的导入中。

有关详细信息,请参阅实际模块的文档:https://metacpan.org/pod/MooseX::FollowPBP