Path::Dispatcher::Match(3pm) User Contributed Perl Documentation Path::Dispatcher::Match(3pm)NAME
Path::Dispatcher::Match - the result of a successful rule match
SYNOPSIS
my $rule = Path::Dispatcher::Rule::Tokens->new(
tokens => [ 'attack', qr/^w+$/ ],
block => sub {
my $match = shift;
attack($match->pos(2))
},
);
my $match = $rule->match("attack dragon");
# introspection
$match->path # "attack dragon"
$match->leftover # empty string (populated with prefix rules)
$match->rule # $rule
$match->positional_captures # ["attack", "dragon"] (decided by the rule)
$match->pos(1) # "attack"
$match->pos(2) # "dragon"
$match->run # attack("dragon")
DESCRIPTION
If a Path::Dispatcher::Rule successfully matches a path, it creates one or more "Path::Dispatcher::Match" objects.
ATTRIBUTES
rule
The Path::Dispatcher::Rule that created this match.
path
The path that the rule matched.
leftover
The rest of the path. This is populated when the rule matches a prefix of the path.
positional_captures
Any positional captures generated by the rule. For example, Path::Dispatcher::Rule::Regex populates this with the capture variables.
named_captures
Any named captures generated by the rule. For example, Path::Dispatcher::Rule::Regex populates this with named captures.
parent
The parent match object, if applicable (which may be set if this match is the child of, for exampl, a Path::Dispatcher::Rule::Under prefix)
METHODS
run
Executes the rule's codeblock with the same arguments.
pos($i)
Returns the $ith positional capture, 1-indexed.
perl v5.12.4 2011-08-30 Path::Dispatcher::Match(3pm)
Check Out this Related Man Page
Path::Dispatcher::Rule::Under(3pm) User Contributed Perl Documentation Path::Dispatcher::Rule::Under(3pm)NAME
Path::Dispatcher::Rule::Under - rules under a predicate
SYNOPSIS
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(shift->pos(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.
perl v5.12.4 2011-08-30 Path::Dispatcher::Rule::Under(3pm)
what is a "mailbomber?" and what is the purpose of posting their ip? Just curious, how do you know you are under attack? things slow down? want to know in case it ever happens to anyone i know, thanks (9 Replies)
Discussion started by: kymberm
9 Replies
2. Post Here to Contact Site Administrators and Moderators
Why did you close all my threads? I undstand that since you may be an advanced unix user, that my questions seem dumb. Hey, they probably are. But the title of the forum is " UNIX for Dummies Questions & Answers" and it says "All UNIX Newbies Welcome !!"
So what is the prob?
I dont think... (7 Replies)
Ok, this has got to be simple, but I can't wrap my head around it.
I'm trying to divid up different parts of a line being inputted. The reason is so I don't have to worry about what order the information is place, I can sort it before it's added to my file.
the line would look something like... (7 Replies)
Reading this file. I want to read all 4 fields.
If 2 is populated with a p, I want to set $TYPEP to "Printers",
if not should be empty.
If 3 is populated with an r, I want to set $TYPER to "REQ Printers"
if not should be empty.
If 4 is populated with letter o, I want to set $TYPEO to... (12 Replies)
I'm at a total loss how to attack this problem.
I have a file that contains
ab
What I need to do is if
1)if the string "ab" doesn't contain a newline, I need to insert one back into the buffer.
2)If the file contains two consecutive blank lines, skip over it.
Here is what I started
... (5 Replies)
i don't want to display the whole line but i want to display all the string(s) that match the Regex, even if their are more then one match per line in my file.
data:
mds_ar/bin/uedw92wp.ksh:cat $AI_SQL/wkly_inqry.sql $AI_SQL/wkly_inqry_trtry.sql $AI_SQL/wkly_nb_trtry.sql \... (18 Replies)
Dear Friend,
I need a help for the below problem.. Can anyone suggest me to do...
Input file data:
rule {
name=mainrule
filt=pos
loc {
x=right + 660
y=top - 3100
}
object_kind= DRAW
... (15 Replies)
hi,
trying to learn more abt sed :(
i want to substitute a variable(a) with other variable(b) appended.
Read.txt contains:
home/test2/abc
home/test/root1
input.txt contains:
make test "home/test1/none"version="1.3"
wt's wrong test "home/test2/abc"version="1.0"
make save... (9 Replies)
Hi guys,
In Windows, whenever I want a execute a program using just a relative path on the command prompt, I simply edit the 'Path' variable and append my parent directory.
Is there something like this available in Unix? I have a binary for Virtualbox called VBoxManage that I want to execute... (6 Replies)
Hello to all,
The Regex below is supposed to match all strings except RR45. I've tested in regex101.com and it works, butwhen I try to use it with the perl command below I get the error shown.
Regex=(?<=^|RR45)(?!RR45).+?(?=RR45|$)
How to fix this? I'm using Cygwin.
$ echo... (9 Replies)
Not sure if my attempt below is close but I am trying to match $1 of gene.txt to $2 of medicalexome.txt,
and if there is a match then $2 $1 are copied to a new result.txt which is tab-delimited. If no match is found then
$1 of gene.txt and "No Match" are copied to the result file.
awk... (9 Replies)
Dear community,
my site was recently attacjed by DDOS technique and goes down in a few minutes. My site runs under Debian/Apache2/Mysql.
I identified the IPs who attack me and block it through iptable firewall from debian.
Something like:
iptables -D INPUT -s xxx.xxx.xxx.xxx -j DROP
This... (7 Replies)
Hello All,
I have 2 files with around 2k records.. I am lost how to build a script to create another file with the below:confused::eek:
Match Condition1:
File1's 12th Columns data should exact match with File2's 19th Column's data
Match Condition2:
File1's 28th Column's data format is... (12 Replies)
Hi All,
I have two file . I need to merge both file based on a match.
File 1:
Column1
column2
column3
column4
File 2:
column3
column5
I need to combine the two file based on match , Which in my case is column3 and combine the file as below
Combined file
Column1 (10 Replies)