++ed by:
Jason M. Mills

NAME

CatalystX::self - A customized self for Catalyst controllers

VERSION

Version 0.01

DESCRIPTION

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');
    }
    
    ...
    

What if I don't like the names of these block words?

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.

EXPORT

self

See "self" in self

args

Returns properly shifted "args" in self for Catalyst controllers

catalyst

Returns Catalyst object. Also known as the second argument in a Catalyst controller method.

AUTHOR

Jason M. Mills, <jmmills at cpan.org>

BUGS

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.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc CatalystX::self

You can also look for information at:

ACKNOWLEDGEMENTS

COPYRIGHT & LICENSE

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.




Hosting generously
sponsored by Bytemark