File Coverage

blib/lib/DPKG/Parse/Available.pm
Criterion Covered Total %
statement 9 9 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 12 12 100.0


line stmt bran cond sub pod time code
1             #
2             # DPKG::Parse::Available.pm
3             # Created by: Adam Jacob, Marchex,
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 parses a dpkg "available" file and turns
27             each entry into a L object. By default, it uses
28             the Debian default location of "/var/lib/dpkg/available".
29              
30             See L for more information on the get_package and next_package
31             methods.
32              
33             See L 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     1   33949 use Params::Validate qw(:all);
  1         12932  
  1         272  
44 1     1   1224 use Class::C3;
  1         3877  
  1         8  
45 1     1   50 use base qw(DPKG::Parse);
  1         2  
  1         727  
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__