[Catalyst] populating stash via action attributes

Michael Reece mreece at vinq.com
Thu Feb 15 01:15:23 GMT 2007


thanks to phaylon, i got this figured out.

[ in a controller base class ]
sub _parse_Hello_attr { ActionClass => 'MyApp::Action::Hello' }



[ and elsewhere... ]
package MyApp::Action::Hello;
use base 'Catalyst::Action';

sub execute {
   my $self = shift;
   my ($controller, $c) = @_;
   $c->stash->{hello} = 'world';
   return $self->NEXT::execute(@_);
}


On Feb 14, 2007, at 4:40 PM, Michael Reece wrote:

>
>
> i am trying to do something along the lines of:
>
> sub foo : Local HelloWorld {
>   my ($self, $c) = @_;
>
>   $c->res->body( $c->stash->{hello} );	# was already set to 'world'  
> because of attribute HelloWorld
> }
>
>
> is this possible?  any tutorials around that deal with such things?
>
>
>
> _______________________________________________
> List: Catalyst at lists.rawmode.org
> Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/ 
> catalyst at lists.rawmode.org/
> Dev site: http://dev.catalyst.perl.org/

---
michael reece :: software engineer :: mreece at vinq.com





More information about the Catalyst mailing list