[Catalyst] another newbie chaining question

John Napiorkowski jjn1056 at yahoo.com
Wed Sep 6 23:28:28 CEST 2006


After a little more digging I discovered that
$c->action when inside a chained action is actually an
ActionChain object.  This is like an object that wraps
each action in the chain up to this point.  It has a
method called ->chain which returns an array ref.  So
I though I could get the previous action thusly:

my @actions = @{$c->action->chain};

my $previous = $#action-1;
my $previous_action = $actions($previous);

However I find this doesn't quite work right.  Does
anyone know if I am on the correct track?

Thanks!

John



--- John Napiorkowski <jjn1056 at yahoo.com> wrote:

> Hi,
> 
> Anyway to get the action which was previous to the
> current one in a given chain?  I know you can get
> the
> previous arguments and captures but right now I'm
> using a stash setting as a hackaround:
> 
> sub first :Chained CaptureArgs(1)
> {
>   my ($self, $c, $arg) = @_;
>   $c->stash->{'last_action'} = $c->action;
> }
> 
> sub second :Chained CaptureArgs(0)
> {
>   my ($self, $c, $arg) = @_;
>  
>   $c->log->debug("The previous action was:
> ".$c->stash->{'last_action'});
> }
> 
> I from looking at all the action code my head is
> spinning a bit.  Anyone run into this kind of
> problem?
> 
> Thanks, sorry for posting so many questions lately,
> I
> know you're all busy like me.
> 
> --john
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam
> protection around 
> http://mail.yahoo.com 
> 
> _______________________________________________
> List: Catalyst at lists.rawmode.org
> Listinfo:
> http://lists.rawmode.org/mailman/listinfo/catalyst
> Searchable archive:
>
http://www.mail-archive.com/catalyst@lists.rawmode.org/
> Dev site: http://dev.catalyst.perl.org/
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the Catalyst mailing list