doc update

This commit is contained in:
Zane C. B-H 2019-08-25 05:58:38 -05:00
parent 0b526672a5
commit af411728ca
2 changed files with 116 additions and 10 deletions

View File

@ -1,16 +1,54 @@
Proc-ProcessTable-Match
The README is used to introduce the module and provide instructions on
how to install the module, any machine dependencies it may have (for
example C compilers and installed libraries) and any other information
that should be provided before the module is installed.
A README file is required for CPAN modules since CPAN extracts the README
file from a module distribution so that people browsing the archive
can use it to get an idea of the module's uses. It is usually a good idea
to provide version information here so that people can decide whether
fixes for the module are worth downloading.
This provides a hand means to construct filters to use to match
with Proc::ProcessTable for matching Proc::ProcessTable::Process
objects.
use Proc::ProcessTable::Match;
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 ) ){
print Dumper( $proc );
}
}
INSTALLATION
@ -42,6 +80,9 @@ You can also look for information at:
Search CPAN
https://metacpan.org/release/Proc-ProcessTable-Match
Repository
https://gitea.eesdp.org/vvelox/Proc-ProcessTable-Match
LICENSE AND COPYRIGHT

View File

@ -21,7 +21,9 @@ our $VERSION = '0.0.0';
use Proc::ProcessTable::Match;
use Proc::ProcessTable;
use Data::Dumper;
# looks for a kernel proc with the PID of 0
my %args=(
checks=>[
{
@ -30,6 +32,23 @@ our $VERSION = '0.0.0';
args=>{
pids=>['0'],
}
},{
type=>'KernProc',
invert=>0,
args=>{
}
}
]
);
# hits on every proc but the idle proc
%args=(
checks=>[
{
type=>'Idle',
invert=>1,
args=>{
}
}
]
);
@ -39,11 +58,48 @@ our $VERSION = '0.0.0';
$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 ) ){
print Dumper( $proc );
}
}
=head1 METHODS
=head2 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.
=head3 checks hash
Every check must hit for it to beconsidered a match.
Each of these should always be defined.
=head4 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'.
=head4 invert
This inverts inverts the returned value from the check.
=head4 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=>[
{
@ -52,6 +108,11 @@ our $VERSION = '0.0.0';
args=>{
pids=>['0'],
}
},{
type=>'KernProc',
invert=>0,
args=>{
}
}
]
);
@ -269,6 +330,10 @@ L<https://cpanratings.perl.org/d/Proc-ProcessTable-Match>
L<https://metacpan.org/release/Proc-ProcessTable-Match>
=item * Repository
L<https://gitea.eesdp.org/vvelox/Proc-ProcessTable-Match>
=back