[Catalyst] Plugin methods and context namespace

John Wang johncwang at gmail.com
Thu Nov 24 23:36:32 CET 2005


To keep the $c context namespace cleaner, I'd like to add plugin methods
like $c->myplugin->foo instead of $c->foo.

I have this working by creating a package MyPlugin and a plugin wrapper
Catalyst::Plugin::MyPlugin. The wrapper just does a few things:

inherits from Class::Data::Inheritable
uses MyPlugin
adds 'myplugin' to classdata
sets $c->myplugin( MyPlugin->new( $c ) ) in prepare

This works, but having an external MyPlugin.pm doesn't seem very clean. Is
there a better way to get plugin methods in the $c->myplugin->foo format?

John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rawmode.org/pipermail/catalyst/attachments/20051124/cb672426/attachment.htm


More information about the Catalyst mailing list