[Catalyst] Organizing link generators

Evan Carroll me at evancarroll.com
Fri Oct 22 17:22:11 GMT 2010


My view often needs to generate complex links for chained actions.
Does anyone have a better way of doing this then recreating the link
generators in the controller?

$c->stash->{generate_link_edit} = sub {
  my $vin = shift;
  $c->uri_for_action(
      '/auth/company/lot/vin/edit'
      , [
        $c->stash->{chained_company_id}
        , $c->stash->{chained_lot_id}
        , $vin
      ]
      , ()
  );
};

$c->stash->{generate_link_vehicle_add} = sub {
  $c->uri_for_action(
      '/auth/company/lot/inventory/add'
      , [
        $c->stash->{chained_company_id}
        , $c->stash->{chained_lot_id}
      ]
      , ()
  );
};

I'm speaking fairly abstract, how do you generate links in views to
controllers with chained actions?

-- 
Evan Carroll - me at evancarroll.com
System Lord of the Internets
web: http://www.evancarroll.com
ph: 281.901.0011



More information about the Catalyst mailing list