blib/lib/OPP/Proc/Whois.pm

filter: Statementstmt 46.1% 12 / 26 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 75.0% 3 / 4 Podpod 0.0% 0 / 1 totaltotal 37.5% 15 / 40 CC 6 SCAR 33.4
CC
6
Cov
35%
process
42.0
BEGIN
1.0
BEGIN
1.0
CRAP 28.3
« blib/lib/OPP/Proc/Splitsubnet.pm ↑ Summary blib/lib/OPP/Proc/Fields.pm »
1 #
2 # $Id: Whois.pm,v 58d7ce835577 2023/03/25 10:34:10 gomor $
3 #
4 package OPP::Proc::Whois;
5 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 ▶use base qw(OPP::Proc);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 __PACKAGE__->cgBuildIndices;
10  
11 1 our $VERSION = '1.00';
12  
13 #
14 # | whois ip
15 # | whois domain
16 #
17 sub process {
18 0 ▶ my $self = shift;
Subroutine process: not called CC=6 SCAR=37.4
Pod undocumented
19 0 my ($input) = @_;
20  
21 0 ▶ my $field = $self->options->{0} || 'domain';
Condition0%0/2
$self->options->{'0'} || 'domain'
l!l
00
MC/DC0%0/1
$self->options->{'0'} || 'domain'
$self->options->{'0'}
Truth table0%0/2
A
A= $self->options->{'0'}
Aresult
11
00
22 0 ▶ return unless defined($field);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $field 0 0 0
23  
24 0 my $values = $self->value($input, $field);
25 0 ▶ return 1 unless defined($values);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $values 0 0 0
26  
27 0 for my $this (@$values) {
28 0 ▶ next if $self->state->exists($this, $self->idx);
Branch: 1 branch
BranchTrueFalseTotal
if $self->state->exists($this, $self->idx) 0 0 0
29 0 $self->state->incr($this, $self->idx);
30  
31 0 my $cmd = "timeout --kill-after=20s --signal=QUIT 15s whois $this";
32  
33 0 my $new = { $field => $this };
34 0 $new->{data} = `$cmd 2> /dev/null`;
35 0 $self->output->add($new);
36 }
37  
38 0 return 1;
39 }
40  
41 1 1;
42  
43 __END__
« blib/lib/OPP/Proc/Splitsubnet.pm ↑ Summary blib/lib/OPP/Proc/Fields.pm »