>>>>> "Evan" == Evan Carroll <[email protected]> writes:

    Evan> My view often needs to generate complex links for chained
    Evan> actions.  Does anyone have a better way of doing this then
    Evan> 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}
      ]
      , ()
  );
};

You should weaken the $c since that code will leak memory without
it. And yes, that's currently the best way to generate urls (that I can
think of anyway), although you can save some typing by using hash slices
instead.

-- 
   Eden Cardim       Need help with your Catalyst or DBIx::Class project?
  Code Monkey                    http://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://blog.edencardim.com/            http://www.shadowcat.co.uk/servers/

_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to