Dpkg/Control/Fields.pm

filter: Statementstmt 86.6% 26 / 30 Branchbran 62.5% 5 / 8 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 77.0% 37 / 48 CC 1 SCAR 0.0
CC
1
Cov
78%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Dpkg.pm ↑ Summary Dpkg/BuildEnv.pm »
1 # Copyright © 2007-2009 Raphaël Hertzog <hertzog@debian.org>
2 #
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <https://www.gnu.org/licenses/>.
15  
16 =encoding utf8
17  
18 =head1 NAME
19  
20 Dpkg::Control::Fields - manage (list of official) control fields
21  
22 =head1 DESCRIPTION
23  
24 The module contains a list of vendor-neutral and vendor-specific field names
25 with associated meta-data explaining in which type of control information
26 they are allowed. The vendor-neutral field names and all functions are
27 inherited from L<Dpkg::Control::FieldsCore>.
28  
29 =cut
30  
31 package Dpkg::Control::Fields 1.00;
32  
33 11 ▶use v5.36;
Subroutine BEGIN: called CC=1 SCAR=0.0
34  
35 11 our @EXPORT = @Dpkg::Control::FieldsCore::EXPORT;
36  
37 11 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
38 11 ▶use Exporter qw(import);
Subroutine BEGIN: called CC=1 SCAR=0.0
39  
40 11 ▶use Dpkg::Control::FieldsCore;
Subroutine BEGIN: called CC=1 SCAR=0.0
41 11 ▶use Dpkg::Vendor qw(run_vendor_hook);
Subroutine BEGIN: called CC=1 SCAR=0.0
42  
43 # Register vendor specifics fields.
44 11 foreach my $op (run_vendor_hook('register-custom-fields')) {
45 # Skip when not implemented by vendor.
46 3 ▶ next if not (defined $op and ref $op);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $op and ref $op 0 3 3
Condition33%1/3
defined $op and ref $op
!ll&&!rl&&r
003
MC/DC0%0/2
defined $op and ref $op
defined $op ref $op
Truth table33%1/3
A and B
A= defined $opB= ref $op
ABresult
0X0
100
111
47 3 my $func = shift @$op;
48 3 ▶ if ($func eq 'register') {
Branch: 3 branches
BranchTrueFalseTotal
if ($func eq 'register') { } 1 2 3
elsif ($func eq 'insert_before') { } 0 2 2
elsif ($func eq 'insert_after') { } 2 0 2
49 1 my ($field, $allowed_type, @opts) = @{$op};
50 1 field_register($field, $allowed_type, @opts);
51 } elsif ($func eq 'insert_before') {
52 0 my ($type, $ref, @fields) = @{$op};
53 0 field_insert_before($type, $ref, @fields);
54 } elsif ($func eq 'insert_after') {
55 2 my ($type, $ref, @fields) = @{$op};
56 2 field_insert_after($type, $ref, @fields);
57 } else {
58 0 croak "vendor hook register-custom-fields sent bad data: @$op";
59 }
60 }
61  
62 =head1 CHANGES
63  
64 =head2 Version 1.00 (dpkg 1.15.6)
65  
66 Mark the module as public.
67  
68 =cut
69  
70 11 1;
« Dpkg.pm ↑ Summary Dpkg/BuildEnv.pm »