Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

path::dispatcher::rule(3pm) [debian man page]

Path::Dispatcher::Rule(3pm)				User Contributed Perl Documentation			       Path::Dispatcher::Rule(3pm)

NAME
Path::Dispatcher::Rule - predicate and codeblock SYNOPSIS
my $rule = Path::Dispatcher::Rule::Regex->new( regex => qr/^quit/, block => sub { die "Program terminated by user. " }, ); $rule->match("die"); # undef, because "die" !~ /^quit/ my $match = $rule->match("quit"); # creates a Path::Dispatcher::Match $match->run; # exits the program DESCRIPTION
A rule has a predicate and an optional codeblock. Rules can be matched (which checks the predicate against the path) and they can be ran (which invokes the codeblock). This class is not meant to be instantiated directly, because there is no predicate matching function. Instead use one of the subclasses such as Path::Dispatcher::Rule::Tokens. ATTRIBUTES
block An optional block of code to be run. Please use the "run" method instead of invoking this attribute directly. prefix A boolean indicating whether this rule can match a prefix of a path. If false, then the predicate must match the entire path. One use-case is that you may want a catch-all rule that matches anything beginning with the token "ticket". The unmatched, latter part of the path will be available in the match object. METHODS
match path -> match Takes a path and returns a Path::Dispatcher::Match object if it matched the predicate, otherwise "undef". The match object contains information about the match, such as the results (e.g. for regex, a list of the captured variables), the "leftover" path if "prefix" matching was used, etc. run Runs the rule's codeblock. If none is present, it throws an exception. perl v5.12.4 2011-08-30 Path::Dispatcher::Rule(3pm)

Check Out this Related Man Page

Log::Report::Dispatcher::Perl(3pm)			User Contributed Perl Documentation			Log::Report::Dispatcher::Perl(3pm)

NAME
Log::Report::Dispatcher::Perl - send messages to die and warn INHERITANCE
Log::Report::Dispatcher::Perl is a Log::Report::Dispatcher SYNOPSIS
dispatcher Log::Report::Dispatcher::Perl => 'default' , accept => 'NOTICE-'; # close the default dispatcher dispatcher close => 'default'; DESCRIPTION
Ventilate the problem reports via the standard Perl error mechanisms: "die()", "warn()", and "print()". There can be only one such dispatcher (per thread), because once "die()" is called, we are not able to return. Therefore, this dispatcher will always be called last. In the early releases of Log::Report, it tried to simulate the behavior of warn and die using STDERR and exit; however: that is not possible. METHODS
Constructors $obj->close See "Constructors" in Log::Report::Dispatcher Log::Report::Dispatcher::Perl->new(TYPE, NAME, OPTIONS) See "Constructors" in Log::Report::Dispatcher Accessors $obj->isDisabled See "Accessors" in Log::Report::Dispatcher $obj->mode See "Accessors" in Log::Report::Dispatcher $obj->name See "Accessors" in Log::Report::Dispatcher $obj->needs See "Accessors" in Log::Report::Dispatcher $obj->type See "Accessors" in Log::Report::Dispatcher Logging $obj->collectLocation Log::Report::Dispatcher::Perl->collectLocation See "Logging" in Log::Report::Dispatcher $obj->collectStack([MAXDEPTH]) Log::Report::Dispatcher::Perl->collectStack([MAXDEPTH]) See "Logging" in Log::Report::Dispatcher $obj->log(HASH-of-OPTIONS, REASON, MESSAGE) See "Logging" in Log::Report::Dispatcher $obj->stackTraceLine(OPTIONS) Log::Report::Dispatcher::Perl->stackTraceLine(OPTIONS) See "Logging" in Log::Report::Dispatcher $obj->translate(HASH-of-OPTIONS, REASON, MESSAGE) See "Logging" in Log::Report::Dispatcher SEE ALSO
This module is part of Log-Report distribution version 0.94, built on August 23, 2011. Website: http://perl.overmeer.net/log-report/ LICENSE
Copyrights 2007-2011 by Mark Overmeer. For other contributors see ChangeLog. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://www.perl.com/perl/misc/Artistic.html perl v5.14.2 2011-08-23 Log::Report::Dispatcher::Perl(3pm)
Man Page