[Catalyst] another newbie chaining question

John Napiorkowski jjn1056 at yahoo.com
Thu Sep 7 19:39:50 CEST 2006


Ah, I see.

I was able to get what I wanted via:

$c->uri_for( $c->controller->action_for('list'),
$c->request->captures );

It's isn't quite as nice since I'm trying to write
something generic for a pager view and I want to avoid
as much possible hard coded stuff from the controller.
 

After looking at the $c->dispatcher->uri_for_action
method I can see why this happens, since as you say
the action chain hasn't been dispatched, right?

Thanks!

John




--- Matt S Trout <dbix-class at trout.me.uk> wrote:

> John Napiorkowski wrote:
> > Some debug info on this.
> > 
> > In my action I have:
> > 
> > my @actions = @{$c->action->chain};
> > 	
> > my $previous = $#actions-1;
> > my $previous_action = $actions[$previous];
> > 	
> > $c->log->dumper($previous_action);
> > 
> > $c->log->dumper($c->uri_for($previous_action,
> > $c->request->captures));
> > 
> > And this is what I get from the debug console:
> > 
> > [debug] $VAR1 = bless( {
> >                  'attributes' => {
> >                                    'CaptureArgs'
> => [
> >                                                   
>   
> > 0
> >                                                   
>  ],
> >                                    'Chained' => [
> >                                                  
> '/'
> >                                                 ],
> >                                    'PartPath' => [
> >                                                   
> > 'templates'
> >                                                  ]
> >                                  },
> >                  'class' =>
> > 'services::Controller::templates',
> >                  'code' => sub { "DUMMY" },
> >                  'name' => 'templates',
> >                  'namespace' => 'templates',
> >                  'reverse' =>
> 'templates/templates'
> >                }, 'Catalyst::Action' );
> > 
> > [debug] $VAR1 = undef;
> > 
> > So it appears I got the right action object but I
> > can't seem to get the URI for it.  Does this have
> > something to do with that fact it may not have
> fully
> > dispatched yet?
> 
> Erm, that action has no URI - it's an action with
> CaptureArgs so it can only 
> exist as *part* of a chain, not as the endpoint of
> one.
> 
> -- 
>       Matt S Trout       Offering custom
> development, consultancy and support
>    Technical Director    contracts for Catalyst,
> DBIx::Class and BAST. Contact
> Shadowcat Systems Ltd.  mst (at)
> shadowcatsystems.co.uk for more information
> 
> + Help us build a better perl ORM:
> http://dbix-class.shadowcatsystems.co.uk/ +
> 
> _______________________________________________
> 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