The current advice is, "don't do it":
19:40 <@hobbs> ijw: unless you have a major back-compatibility requirement, always write a role. A role for the app is equivalent to a plugin.
From the Catalyst manual, as it presently stands:
Plugins
The first thing to say about plugins is that if you're not sure if your module should be a plugin, it probably shouldn't. It once was common to add features to Catalyst by writing plugins that provide accessors to said functionality. As Catalyst grew more popular, it became obvious that this qualifies as bad practice.
There's other useful design advice there, well worth a read if you're thinking of this and you have a couple of minutes. To summarise the plugin/role choice, if you're doing something that someone's going to use in a new application but is unlikely to be of use in an old one, you might as well make it a role: the plugin architecture's only real advantage is that it gives you backward compatibility with pre-Moose versions.
No comments:
Post a Comment