Query/Package.pm

filter: Statementstmt 28.2% 11 / 39 Branchbran 0.0% 0 / 16 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 17.6% 3 / 17 Podpod 100% 14 / 14 totaltotal 32.5% 28 / 86 CC 9 SCAR 17.2
CC
9
Cov
20%
package_name
12.0
parent
12.0
requires
6.0
CRAP 5.6
« Query/Capability.pm ↑ Summary
1 package RPM::Query::Package;
2 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 5 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 5 ▶use base qw{Package::New};
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 5 our $VERSION = '0.05';
7  
8 =head1 NAME
9  
10 RPM::Query - Perl object overlay of an RPM package
11  
12 =head1 SYNOPSIS
13  
14 use RPM::Query::Package;
15 my $package = RPM::Query::Package->new(package_name=>'perl-5.16.3-299.el7_9.x86_64');
16 my $name = $rpm->name; #is short name e.g. "perl"
17 my $capabilities = $rpm->requires; #isa list of RPM::Query::Capability
18 foreach my $capability (@$capabilities) {
19 printf "%s - %s\n", $capability->name, $capability->package->package_name;
20 }
21  
22 =head1 DESCRIPTION
23  
24 =head1 METHODS
25  
26 =head2 package_name
27  
28 Returns the the long package name which is the unique package token that rpm uses for this package.
29  
30 =cut
31  
32 0 ▶sub package_name {
Subroutine package_name: not called CC=3 SCAR=24.8
Pod documented
33 0 my $self = shift;
34 0 ▶ $self->{'package_name'} = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
35 0 ▶ die("Error: package_name property required") unless $self->{'package_name'};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"package_name"} 0 0 0
36 0 return $self->{'package_name'};
37 }
38  
39 =head2 requires
40  
41 Returns a list of L<RPM::Query::Capability> objects that the package requires
42  
43 =cut
44  
45 0 ▶sub requires {
Subroutine requires: not called CC=2 SCAR=17.9
Pod documented
46 0 my $self = shift;
47 0 ▶ $self->{'requires'} = $self->parent->requires($self->package_name) unless $self->{'requires'};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"requires"} 0 0 0
48 0 return $self->{'requires'};
49 }
50  
51 =head2 provides
52  
53 Returns a list of L<RPM::Query::Capability> objects that the package provides
54  
55 =cut
56  
57 0 ▶sub provides {
Subroutine provides: not called CC=2 SCAR=17.9
Pod documented
58 0 my $self = shift;
59 0 ▶ $self->{'provides'} = $self->parent->provides($self->package_name) unless $self->{'provides'};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"provides"} 0 0 0
60 0 return $self->{'provides'};
61 }
62  
63 =head2 verify
64  
65 Returns a Boolean value on whether or not the installed RPM passes the verify command.
66  
67 =cut
68  
69 0 ▶sub verify {
Subroutine verify: not called CC=2 SCAR=17.9
Pod documented
70 0 my $self = shift;
71 0 ▶ $self->{'verify'} = $self->parent->verify($self->package_name) unless $self->{'verify'};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"verify"} 0 0 0
72 0 return $self->{'verify'};
73 }
74  
75 =head2 details
76  
77 Returns select rpm tags as a hash reference where the key is a lower case tag.
78  
79 Note: Not all tags are supported.
80  
81 =cut
82  
83 0 ▶sub details {
Subroutine details: not called CC=2 SCAR=17.9
Pod documented
84 0 my $self = shift;
85 0 ▶ $self->{'details'} = $self->parent->details($self->package_name) unless $self->{'details'};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"details"} 0 0 0
86 0 return $self->{'details'};
87 }
88  
89 =head2 name
90  
91 Returns the short package name
92  
93 =cut
94  
95 0 ▶sub name {shift->details->{'name'}};
Subroutine name: not called CC=1 SCAR=6.9
Pod documented
96  
97 =head2 description
98  
99 Returns the package description (multiline)
100  
101 =cut
102  
103 0 ▶sub description {shift->details->{'description'}};
Subroutine description: not called CC=1 SCAR=6.9
Pod documented
104  
105 =head2 summary
106  
107 =cut
108  
109 0 ▶sub summary {shift->details->{'summary'}};
Subroutine summary: not called CC=1 SCAR=6.9
Pod documented
110  
111 =head2 url
112  
113 =cut
114  
115 0 ▶sub url {shift->details->{'url'}};
Subroutine url: not called CC=1 SCAR=6.9
Pod documented
116  
117 =head2 version
118  
119 =cut
120  
121 0 ▶sub version {shift->details->{'version'}};
Subroutine version: not called CC=1 SCAR=6.9
Pod documented
122  
123 =head2 sourcerpm
124  
125 =cut
126  
127 0 ▶sub sourcerpm {shift->details->{'sourcerpm'}};
Subroutine sourcerpm: not called CC=1 SCAR=6.9
Pod documented
128  
129 =head2 license
130  
131 =cut
132  
133 0 ▶sub license {shift->details->{'license'}};
Subroutine license: not called CC=1 SCAR=6.9
Pod documented
134  
135 =head2 sigmd5
136  
137 =cut
138  
139 0 ▶sub sigmd5 {shift->details->{'sigmd5'}};
Subroutine sigmd5: not called CC=1 SCAR=6.9
Pod documented
140  
141 =head1 ACCESSORS
142  
143 =head2 parent
144  
145 =cut
146  
147 0 ▶sub parent {
Subroutine parent: not called CC=3 SCAR=24.8
Pod documented
148 0 my $self = shift;
149 0 ▶ $self->{'parent'} = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
150 0 ▶ $self->{'parent'} = RPM::Query->new unless $self->{'parent'};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"parent"} 0 0 0
151 0 return $self->{'parent'};
152 }
153  
154 =head1 SEE ALSO
155  
156 =head1 AUTHOR
157  
158 Michael R. Davis
159  
160 =head1 COPYRIGHT AND LICENSE
161  
162 MIT License
163  
164 Copyright (c) 2023 Michael R. Davis
165  
166 =cut
167  
168 5 1;
« Query/Capability.pm ↑ Summary