NVD/Store/Base.pm

filter: Statementstmt 46.1% 12 / 26 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 27.2% 3 / 11 Podpod 100% 4 / 4 totaltotal 36.5% 19 / 52 CC 6 SCAR 20.6
CC
6
Cov
33%
AUTOLOAD
20.0
new
12.0
_important_fields
2.0
CRAP 7.9
↑ Summary NVD/Query.pm »
1 package NIST::NVD::Store::Base;
2  
3 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 ▶use Carp(qw(croak));
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 2 our $VERSION = '1.02.01';
9  
10 =head2 get_cve_for_cpe
11  
12 =cut
13  
14 0 ▶sub get_cve_for_cpe {
Subroutine get_cve_for_cpe: not called CC=1 SCAR=0.0
Pod documented
15  
16 }
17  
18 =head2 get_cve
19  
20  
21 =cut
22  
23 0 ▶sub get_cve {
Subroutine get_cve: not called CC=1 SCAR=0.0
Pod documented
24  
25 }
26  
27 =head2 put_cpe
28  
29  
30 =cut
31  
32 0 ▶sub put_cpe {
Subroutine put_cpe: not called CC=1 SCAR=0.0
Pod documented
33  
34 }
35  
36 0 ▶sub _get_default_args {
Subroutine _get_default_args: not called CC=1 SCAR=0.0
37  
38 }
39  
40 =head2 new
41  
42 The constructor for classes which inherit from
43 NIST::NVD::Store::Base, if they don't implement it themselves
44  
45 =cut
46  
47 0 ▶sub new {
Subroutine new: not called CC=3 SCAR=24.8
Pod documented
48 0 (my( $class, %args )) = @_;
49 0 ▶ $class //= ref $class;
Condition0%0/2
$class //= ref $class
l!l
00
MC/DC0%0/1
$class //= ref $class
$class
Truth table0%0/2
A
A= $class
Aresult
11
00
50  
51 0 my $self = bless {store => $args{store}}, $class;
52  
53 0 my $store = $args{store};
54  
55 carp('database argument is required, but was not passed')
56 0 ▶ unless exists $args{database};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $args{"database"} 0 0 0
57  
58 0 $self->{$store} = $self->_connect_db( database => $args{database} );
59  
60 0 return $self;
61 }
62  
63 0 ▶sub _important_fields {
Subroutine _important_fields: not called CC=1 SCAR=6.9
64 return
65 0 qw(
66 vuln:cve-id
67 vuln:cvss
68 vuln:cwe
69 vuln:discovered-datetime
70 vuln:published-datetime
71 vuln:discovered-datetime
72 vuln:last-modified-datetime
73 vuln:security-protection
74 vuln:vulnerable-software-list
75 );
76  
77 }
78  
79 2 our $AUTOLOAD;
80  
81 0 ▶sub AUTOLOAD {
Subroutine AUTOLOAD: not called CC=4 SCAR=30.0
82 0 my $self = shift;
83 0 ▶ my $type = ref($self)
Branch: 1 branch
BranchTrueFalseTotal
my $type = ref $self or croak("$self is not an object") 0 0 0
84 or croak "$self is not an object";
85  
86 0 my $name = $AUTOLOAD;
87  
88 0 $name =~ s/^.*://;
89  
90 0 ▶ return if $name eq 'DESTROY';
Branch: 1 branch
BranchTrueFalseTotal
if $name eq "DESTROY" 0 0 0
91  
92 0 ▶ croak "$type does not yet implement $name. Don't call it."
Branch: 1 branch
BranchTrueFalseTotal
unless $type->can($name) 0 0 0
93 unless $type->can($name);
94 }
95  
96 0 ▶sub DESTROY {}
Subroutine DESTROY: not called CC=1 SCAR=0.0
97  
98 2 1;
↑ Summary NVD/Query.pm »