File Coverage

blib/lib/Dpkg/Control/Fields.pm
Criterion Covered Total %
statement 18 18 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod n/a
total 24 24 100.0


line stmt bran cond sub pod time code
1             # Copyright © 2007-2009 Raphaël Hertzog
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 .
15              
16             package Dpkg::Control::Fields;
17              
18 8     8   119 use strict;
  8         18  
  8         235  
19 8     8   39 use warnings;
  8         16  
  8         512  
20              
21             our $VERSION = '1.00';
22             our @EXPORT = @Dpkg::Control::FieldsCore::EXPORT;
23              
24 8     8   58 use Carp;
  8         14  
  8         517  
25 8     8   52 use Exporter qw(import);
  8         26  
  8         287  
26              
27 8     8   4662 use Dpkg::Control::FieldsCore;
  8         37  
  8         829  
28 8     8   3906 use Dpkg::Vendor qw(run_vendor_hook);
  8         31  
  8         1692  
29              
30             # Register vendor specifics fields
31             foreach my $op (run_vendor_hook('register-custom-fields')) {
32             next if not (defined $op and ref $op); # Skip when not implemented by vendor
33             my $func = shift @$op;
34             if ($func eq 'register') {
35             my ($field, $allowed_type, @opts) = @{$op};
36             field_register($field, $allowed_type, @opts);
37             } elsif ($func eq 'insert_before') {
38             my ($type, $ref, @fields) = @{$op};
39             field_insert_before($type, $ref, @fields);
40             } elsif ($func eq 'insert_after') {
41             my ($type, $ref, @fields) = @{$op};
42             field_insert_after($type, $ref, @fields);
43             } else {
44             croak "vendor hook register-custom-fields sent bad data: @$op";
45             }
46             }
47              
48             =encoding utf8
49              
50             =head1 NAME
51              
52             Dpkg::Control::Fields - manage (list of official) control fields
53              
54             =head1 DESCRIPTION
55              
56             The module contains a list of vendor-neutral and vendor-specific fieldnames
57             with associated meta-data explaining in which type of control information
58             they are allowed. The vendor-neutral fieldnames and all functions are
59             inherited from Dpkg::Control::FieldsCore.
60              
61             =head1 CHANGES
62              
63             =head2 Version 1.00 (dpkg 1.15.6)
64              
65             Mark the module as public.
66              
67             =cut
68              
69             1;