File Coverage

blib/lib/Proc/ProcessTable/Match/EGIDset.pm
Criterion Covered Total %
statement 11 33 33.3
branch 0 10 0.0
condition n/a
subroutine 4 6 66.6
pod 2 2 100.0
total 17 51 33.3


line stmt bran cond sub pod time code
1             package Proc::ProcessTable::Match::EGIDset;
2              
3 1     1   64880 use 5.006;
  1         13  
4 1     1   5 use strict;
  1         2  
  1         32  
5 1     1   6 use warnings;
  1         2  
  1         27  
6 1     1   616 use User::pwent;
  1         6017  
  1         3  
7              
8             =head1 NAME
9              
10             Proc::ProcessTable::Match::EGIDset - Check if the the process has a EGID set.
11              
12             =head1 VERSION
13              
14             Version 0.0.0
15              
16             =cut
17              
18             our $VERSION = '0.0.0';
19              
20              
21             =head1 SYNOPSIS
22              
23             use Proc::ProcessTable::Match::EGIDset;
24            
25             my $checker=Proc::ProcessTable::Match::EGIDset->new;
26            
27             if ( $checker->match( $proc ) ){
28             print "It matches.\n";
29             }
30              
31             =head1 METHODS
32              
33             =head2 new
34              
35             This intiates the object.
36              
37             my $checker=Proc::ProcessTable::Match::EGIDset->new;
38              
39             =cut
40              
41             sub new{
42 0     0 1   my $self = {
43             };
44 0           bless $self;
45              
46 0           return $self;
47             }
48              
49             =head2 match
50              
51             Checks if a single Proc::ProcessTable::Process object matches the stack.
52              
53             One argument is taken and that is a Proc::ProcessTable::Process object.
54              
55             The returned value is a boolean.
56              
57             if ( $checker->match( $proc ) ){
58             print "The process matches.\n";
59             }
60              
61             =cut
62              
63             sub match{
64 0     0 1   my $self=$_[0];
65 0           my $object=$_[1];
66              
67 0 0         if ( !defined( $object ) ){
68 0           return 0;
69             }
70              
71 0 0         if ( ref( $object ) ne 'Proc::ProcessTable::Process' ){
72 0           return 0;
73             }
74              
75 0           my $proc_gid;
76 0           eval{
77 0           $proc_gid=$object->gid;
78             };
79              
80             # don't bother proceeding, the object won't match ever
81             # as it does not have a GID
82 0 0         if ( ! defined( $proc_gid ) ){
83 0           return 0;
84             }
85              
86 0           my $proc_egid;
87 0           eval{
88 0           $proc_egid=$object->egid;
89             };
90              
91             # don't bother proceeding, the object won't match ever
92             # as it does not have a EGID
93 0 0         if ( ! defined( $proc_egid ) ){
94 0           return 0;
95             }
96              
97 0 0         if ( $proc_egid ne $proc_gid ){
98 0           return 1;
99             }
100              
101 0           return 0;
102             }
103              
104             =head1 AUTHOR
105              
106             Zane C. Bowers-Hadley, C<< >>
107              
108             =head1 BUGS
109              
110             Please report any bugs or feature requests to C, or through
111             the web interface at L. I will be notified, and then you'll
112             automatically be notified of progress on your bug as I make changes.
113              
114              
115              
116              
117             =head1 SUPPORT
118              
119             You can find documentation for this module with the perldoc command.
120              
121             perldoc Proc::ProcessTable::Match
122              
123              
124             You can also look for information at:
125              
126             =over 4
127              
128             =item * RT: CPAN's request tracker (report bugs here)
129              
130             L
131              
132             =item * AnnoCPAN: Annotated CPAN documentation
133              
134             L
135              
136             =item * CPAN Ratings
137              
138             L
139              
140             =item * Search CPAN
141              
142             L
143              
144             =back
145              
146              
147             =head1 ACKNOWLEDGEMENTS
148              
149              
150             =head1 LICENSE AND COPYRIGHT
151              
152             Copyright 2019 Zane C. Bowers-Hadley.
153              
154             This program is free software; you can redistribute it and/or modify it
155             under the terms of the the Artistic License (2.0). You may obtain a
156             copy of the full license at:
157              
158             L
159              
160             Any use, modification, and distribution of the Standard or Modified
161             Versions is governed by this Artistic License. By using, modifying or
162             distributing the Package, you accept this license. Do not use, modify,
163             or distribute the Package, if you do not accept this license.
164              
165             If your Modified Version has been derived from a Modified Version made
166             by someone other than you, you are nevertheless required to ensure that
167             your Modified Version complies with the requirements of this license.
168              
169             This license does not grant you the right to use any trademark, service
170             mark, tradename, or logo of the Copyright Holder.
171              
172             This license includes the non-exclusive, worldwide, free-of-charge
173             patent license to make, have made, use, offer to sell, sell, import and
174             otherwise transfer the Package with respect to any patent claims
175             licensable by the Copyright Holder that are necessarily infringed by the
176             Package. If you institute patent litigation (including a cross-claim or
177             counterclaim) against any party alleging that the Package constitutes
178             direct or contributory patent infringement, then this Artistic License
179             to you shall terminate on the date that such litigation is filed.
180              
181             Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER
182             AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
183             THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
184             PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY
185             YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR
186             CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR
187             CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE,
188             EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
189              
190              
191             =cut
192              
193             1; # End of Proc::ProcessTable::Match