Adding controllers to an app from a plugin

View: New views
2 Messages — Rating Filter:   Alert me  

Adding controllers to an app from a plugin

by Edmund von der Burg-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello all.

I want to create a plugin that adds a controller to an app. From
looking at code on CPAN that does this* it seems that manually
creating controllers in the project that inherit from the one that is
provided by the plugin is the way to do it.

Another way to do it is to intercept the request in 'dispatch' and
take the appropriate action** - but I really don't like that at all.
For starters I want my controller to appear like all the others in the
debug output.

Is there already code on CPAN that helps me inject my plugin
controller into the app? Is there a better way to do this? Should I
rip out the smarts from C::P::AutoCRUD and make them reusable (and if
so what should it be called)?

Cheers,
  Edmund.

* http://cpansearch.perl.org/src/OLIVER/Catalyst-Plugin-AutoCRUD-0.56/lib/Catalyst/Plugin/AutoCRUD.pm
** http://cpansearch.perl.org/src/AGRUNDMA/Catalyst-Plugin-UploadProgress-0.04/lib/Catalyst/Plugin/UploadProgress.pm

_______________________________________________
List: Catalyst@...
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@.../
Dev site: http://dev.catalyst.perl.org/

Re: Adding controllers to an app from a plugin

by Tomas Doran :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On 7 Nov 2009, at 20:06, Edmund von der Burg wrote:
> Is there already code on CPAN that helps me inject my plugin
> controller into the app? Is there a better way to do this? Should I
> rip out the smarts from C::P::AutoCRUD and make them reusable (and if
> so what should it be called)?

You're after CatalystX::InjectComponent

Cheers
t0m


_______________________________________________
List: Catalyst@...
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@.../
Dev site: http://dev.catalyst.perl.org/