[Catalyst] local redirect ?

Matt S Trout dbix-class at trout.me.uk
Sun Jan 22 21:25:48 CET 2006


On Sun, Jan 22, 2006 at 10:44:44PM +0200, raptor wrote:
> I have a controller called Admin.pm then inside i have :
> 
> sub list : Local {
>  ...cdbi->retrieve_all();
>  $c->forward("...::View::TT");
> }
> 
> sub remove : Local {
>  ....cdbi->delete();
>  $c->res->redirect('list');
> }
> 
> 
> but when remove is executed I get error, regarding delete() which executed successfully! as I check the list later.
> If i change this : 
>  $c->res->redirect('list');
> to this :
>  $c->res->redirect('/admin/list');
> everything is ok.
> In the first case redirect goes to /admin/remove/list
> 
> any idea? or I'm doing something stupid.

If your original URL is /admin/remove/XX, then a relative link of 'list' would
indicate /admin/remove/list. Try

$c->res->redirect($c->uri_for($c->namespace, 'list'));

instad.

-- 
     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/ +



More information about the Catalyst mailing list