Query: path::dispatcher::rule::tokens
OS: debian
Section: 3pm
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
Path::Dispatcher::Rule::Tokens(3pm) User Contributed Perl Documentation Path::Dispatcher::Rule::Tokens(3pm)NAMEPath::Dispatcher::Rule::Tokens - predicate is a list of tokensSYNOPSISmy $rule = Path::Dispatcher::Rule::Tokens->new( tokens => [ "comment", "show", qr/^d+$/ ], delimiter => '/', block => sub { display_comment(shift->pos(3)) }, ); $rule->match("/comment/show/25");DESCRIPTIONRules of this class use a list of tokens to match the path.ATTRIBUTEStokens Each token can be a literal string, a regular expression, or a list of either (which are taken to mean alternations). For example, the tokens: [ 'ticket', [ 'show', 'display' ], [ qr/^d+$/, qr/^#w{3}/ ] ] first matches "ticket". Then, the next token must be "show" or "display". The final token must be a number or a pound sign followed by three word characters. The results are the tokens in the original string, as they were matched. If you have three tokens, then "match->pos(1)" will be the string's first token ("ticket"), "match->pos(2)" its second ("display"), and "match->pos(3)" its third ("#AAA"). Capture groups inside a regex token are completely ignored. delimiter A string that is used to tokenize the path. The delimiter must be a string because prefix matches use "join" on unmatched tokens to return the leftover path. In the future this may be extended to support having a regex delimiter. The default is a space, but if you're matching URLs you probably want to change this to a slash. case_sensitive Decide whether the rule matching is case sensitive. Default is 1, case sensitive matching. perl v5.12.4 2011-08-30 Path::Dispatcher::Rule::Tokens(3pm)
Related Man Pages |
---|
tokens(1) - debian |
token_get_all(3) - php |
latexml::token(3pm) - debian |
path::dispatcher::declarative(3pm) - debian |
path::dispatcher::match(3pm) - debian |
Similar Topics in the Unix Linux Community |
---|
how to get the pos() of 2 str matches in one loop in perl |
Chiron 1 (Default branch) |
regex question |
Help needed regarding first 3 items in the list |
Reading tokens |