Rechercher une page de manuel
Path::Dispatcher::Rule::Under.3pm
Langue: en
Version: 2009-12-31 (ubuntu - 24/10/10)
Section: 3 (Bibliothèques de fonctions)
NAME
Path::Dispatcher::Rule::Under - rules under a predicateSYNOPSIS
my $ticket = Path::Dispatcher::Rule::Tokens->new( tokens => [ 'ticket' ], prefix => 1, ); my $create = Path::Dispatcher::Rule::Tokens->new( tokens => [ 'create' ], block => sub { create_ticket() }, ); my $delete = Path::Dispatcher::Rule::Tokens->new( tokens => [ 'delete', qr/^\d+$/ ], block => sub { delete_ticket($2) }, ); my $rule = Path::Dispatcher::Rule::Under->new( predicate => $ticket, rules => [ $create, $delete ], ); $rule->match("ticket create"); $rule->match("ticket delete 3");
DESCRIPTION
Rules of this class have two-phase matching: if the predicate is matched, then the contained rules are matched. The benefit of this is less repetition of the predicate, both in terms of code and in matching it.ATTRIBUTES
predicate
A rule (which must match prefixes) whose match determines whether the contained rules are considered. The leftover path of the predicate is used as the path for the contained rules.rules
A list of rules that will be try to be matched only if the predicate is matched.Contenus ©2006-2024 Benjamin Poulain
Design ©2006-2024 Maxime Vantorre