Parse/Packages.pm

filter: Statementstmt 100% 9 / 9 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 100% 12 / 12 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Parse/Entry.pm ↑ Summary
1 #
2 # DPKG::Parse::Packages.pm
3 # Created by: Adam Jacob, Marchex, <adam@marchex.com>
4 # Created on: 12/19/2005 02:21:25 PM PST
5 #
6 # $Id: $
7  
8 =head1 NAME
9  
10 DPKG::Parse::Packages - Parse the Packages file
11  
12 =head1 SYNOPSIS
13
14 use DPKG::Parse::Packages;
15
16 my $packages = DPKG::Parse::Packages->new(
17 'filename' => '/usr/src/packages/Packages',
18 );
19 while (my $entry = $packages->next_package) {
20 print $entry->package . " " . $entry->version . "\n";
21 }
22  
23 my $postfix = $packages->get_package('name' => 'postfix');
24  
25 =head1 DESCRIPTION
26  
27 L<DPKG::Parse::Packages> parses a dpkg/apt style Packages file and turns
28 each entry into a L<DPKG::Parse::Entry> object.
29  
30 See L<DPKG::Parse> for more information on the get_package and next_package
31 methods.
32  
33 See L<DPKG::Parse::Entry> for more information on the entry objects.
34  
35 =head1 METHODS
36  
37 =over 4
38  
39 =cut
40  
41 package DPKG::Parse::Packages;
42  
43 1 ▶use Params::Validate qw(:all);
Subroutine BEGIN: called CC=1 SCAR=0.0
44 1 ▶use Class::C3;
Subroutine BEGIN: called CC=1 SCAR=0.0
45 1 ▶use base qw(DPKG::Parse);
Subroutine BEGIN: called CC=1 SCAR=0.0
46 use strict;
47 use warnings;
48  
49 =item new('filename' => '/usr/src/packages/Packages')
50  
51 Creates a new DPKG::Parse::Packages object. By default, it tries to open
52 /usr/src/packages/Packages.
53  
54 =cut
55 sub new {
56 my $pkg = shift;
57 my %p = validate(@_,
58 {
59 'filename' => { 'type' => SCALAR, 'default' => '/usr/src/packages/Packages', 'optional' => 1 },
60 }
61 );
62 my $ref = $pkg->next::method('filename' => $p{'filename'});
63 return $ref;
64 }
65  
66 1;
67  
68 __END__
« Parse/Entry.pm ↑ Summary