In Catalyst, I don't understand what does the for means in the $c->URI_for();
subrouti开发者_开发百科ne.
Is it an abbrev for for + something (could be forward), an acronym or something ?
It means the URI for whatever that particular $c
is.
$c->uri_for( $path, @args?, \%query_values? )
Merges path with
$c->request->base
for absolute URIs and with$c->namespace
for relative URIs, then returns a normalized URI object. If any args are passed, they are added at the end of the path. If the last argument touri_for
is a hash reference, it is assumed to contain GET parameter key/value pairs, which will be appended to the URI in standard fashion.Instead of
$path
, you can also optionally pass a$action
object which will be resolved to a path using$c->dispatcher->uri_for_action
; if the first element of@args
is an arrayref it is treated as a list of captures to be passed touri_for_action
.
In terms of French, think of it in terms of pour
, as in Nom pour le livre
(name for the book) although, given it's been some twenty years since I last actually spoke French, I may have inadverdently insulted your heritage :-)
The for
in uri_for
is not an acronym. Read it like:
- URI for path
- URI for action
精彩评论