NAME
Proc::ProcessTable::Match - Matches a Proc::ProcessTable::Process against a stack of checks.
VERSION
Version 0.0.1
SYNOPSIS
use
Proc::ProcessTable;
use
Data::Dumper;
# looks for a kernel proc with the PID of 0
my
%args
=(
checks
=>[
{
type
=>
'PID'
,
invert
=>0,
args
=>{
pids
=>[
'0'
],
}
},{
type
=>
'KernProc'
,
invert
=>0,
args
=>{
}
}
]
);
# hits on every proc but the idle proc
%args
=(
checks
=>[
{
type
=>
'Idle'
,
invert
=>1,
args
=>{
}
}
]
);
my
$ppm
;
eval
{
$ppm
=Proc::ProcessTable::Match->new( \
%args
);
} or
die
"New failed with..."
.$@;
my
$pt
= Proc::ProcessTable->new;
foreach
my
$proc
( @{
$t
->table} ){
if
(
$ppm
->match(
$proc
) ){
Dumper(
$proc
);
}
}
METHODS
new
This ininitates the object.
One argument is taken and it is a hashref with the key "checks". That value needs to contains a array of hashs of checks to run.
checks hash
Every check must hit for it to beconsidered a match.
Each of these should always be defined.
type
This is the module to use to use to run the check.
The name is relative 'Proc::ProcessTable::Match::', so 'PID' becomes 'Proc::ProcessTable::Match::PID'.
invert
This inverts inverts the returned value from the check.
args
This is a hash that will be pashed to the checker module's new method.
For any required keys, check the documents for that checker.
If it does not take any arguments, just pass a blank hash.
my
%args
=(
checks
=>[
{
type
=>
'PID'
,
invert
=>0,
args
=>{
pids
=>[
'0'
],
}
},{
type
=>
'KernProc'
,
invert
=>0,
args
=>{
}
}
]
);
my
$ppm
;
eval
{
$ppm
=Proc::ProcessTable::Match->new( \
%args
);
} or
die
"New failed with..."
.$@;
match
Checks if a single Proc::ProcessTable::Process object matches the stack.
One object is argument is taken and that is the Net::Connection to check.
The return value is a boolean.
if
(
$ppm
->match(
$conn
) ){
"It matched.\n"
;
}
AUTHOR
Zane C. Bowers-Hadley, <vvelox at vvelox.net>
BUGS
Please report any bugs or feature requests to bug-proc-processtable-match at rt.cpan.org
, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Proc-ProcessTable-Match. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Proc::ProcessTable::Match
You can also look for information at:
RT: CPAN's request tracker (report bugs here)
https://rt.cpan.org/NoAuth/Bugs.html?Dist=Proc-ProcessTable-Match
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
Repository
ACKNOWLEDGEMENTS
LICENSE AND COPYRIGHT
This software is Copyright (c) 2019 by Zane C. Bowers-Hadley.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)