Parse/Available.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.pm ↑ Summary Parse/Entry.pm »
1 #
2 # DPKG::Parse::Available.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  
9 =head1 NAME
10  
11 DPKG::Parse::Available - Parse the "available" file
12  
13 =head1 SYNOPSIS
14
15 use DPKG::Parse::Available;
16
17 my $available = DPKG::Parse::Available->new;
18 while (my $entry = $available->next_package) {
19 print $entry->package . " " . $entry->version . "\n";
20 }
21  
22 my $postfix = $available->get_package('name' => 'postfix');
23  
24 =head1 DESCRIPTION
25  
26 L<DPKG::Parse::Available> parses a dpkg "available" file and turns
27 each entry into a L<DPKG::Parse::Entry> object. By default, it uses
28 the Debian default location of "/var/lib/dpkg/available".
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::Available;
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' => '/var/lib/dpkg/available')
50  
51 Creates a new DPKG::Parse::Available object. By default, it tries to open
52 /var/lib/dpkg/available.
53  
54 =cut
55 sub new {
56 my $pkg = shift;
57 my %p = validate(@_,
58 {
59 'filename' => { 'type' => SCALAR, 'default' => '/var/lib/dpkg/available', 'optional' => 1 },
60 }
61 );
62 my $ref = $pkg->next::method('filename' => $p{'filename'});
63 return $ref;
64 }
65  
66 1;
67  
68 __END__
« Parse.pm ↑ Summary Parse/Entry.pm »