CatalystX::self - A customized self for Catalyst controllers
Version 0.01
This is a very simple but handy module that shifts some of bits around from self to allow for an easier usage with (and with in) Catalyst controllers.
package MyApp::Foo; use parent 'Catalyst::Controller'; use CatalystX::self; sub bar : Local { my ($some,$params) = args; self->action_for('name'); catalyst->response->body('Hello World'); } ...
Simple! Since self and this module utilize Sub::Exporter you may rename the methods as you see fit. Here is an example that renames the args block word into some else and the catalyst block word into the more common and shorter 'c'.
package MyApp::LostShoes; use parent 'Catalyst::Controller'; use CatalystX::self ( catalyst => { -as => 'c' }, args => { -as => 'gnargles' }, self => { -as => 'this' } ); sub bar : Local { this->{shoe} = gnargles; c->res->body($this->{shoe}); } ...
You may also use the '-as' import renaming trick to do "aliases".
use CatalystX::self ( catalyst => { -as => 'c' }, '-all' );
Now we have both 'catalyst' and 'c' block words.
See "self" in self
Returns properly shifted "args" in self for Catalyst controllers
Returns Catalyst object. Also known as the second argument in a Catalyst controller method.
Jason M. Mills, <jmmills at cpan.org>
<jmmills at cpan.org>
Please report any bugs or feature requests to bug-catalystx-self at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=CatalystX-self. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-catalystx-self at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc CatalystX::self
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=CatalystX-self
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/CatalystX-self
CPAN Ratings
http://cpanratings.perl.org/d/CatalystX-self
Search CPAN
http://search.cpan.org/dist/CatalystX-self
Copyright 2008 Jason M. Mills, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install CatalystX::self, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CatalystX::self
CPAN shell
perl -MCPAN -e shell install CatalystX::self
For more information on module installation, please visit the detailed CPAN module installation guide.