line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
=head1 NAME |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
DPKG::Parse::Available - Parse the "available" file |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 SYNOPSIS |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use DPKG::Parse::Available; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
my $available = DPKG::Parse::Available->new; |
10
|
|
|
|
|
|
|
while (my $entry = $available->next_package) { |
11
|
|
|
|
|
|
|
print $entry->package . " " . $entry->version . "\n"; |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
my $postfix = $available->get_package('name' => 'postfix'); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 DESCRIPTION |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
L parses a dpkg "available" file and turns |
19
|
|
|
|
|
|
|
each entry into a L object. By default, it uses |
20
|
|
|
|
|
|
|
the Debian default location of "/var/lib/dpkg/available". |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
See L for more information on the get_package and next_package |
23
|
|
|
|
|
|
|
methods. |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
See L for more information on the entry objects. |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 METHODS |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=over 4 |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=cut |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
package DPKG::Parse::Available; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
our $VERSION = '0.03'; |
36
|
|
|
|
|
|
|
|
37
|
2
|
|
|
2
|
|
23953
|
use Params::Validate qw(:all); |
|
2
|
|
|
|
|
6802
|
|
|
2
|
|
|
|
|
292
|
|
38
|
2
|
|
|
2
|
|
437
|
use Class::C3; |
|
2
|
|
|
|
|
2447
|
|
|
2
|
|
|
|
|
9
|
|
39
|
2
|
|
|
2
|
|
64
|
use base qw(DPKG::Parse); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
562
|
|
40
|
2
|
|
|
2
|
|
9
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
45
|
|
41
|
2
|
|
|
2
|
|
18
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
156
|
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=item new('filename' => '/var/lib/dpkg/available') |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
Creates a new DPKG::Parse::Available object. By default, it tries to open |
46
|
|
|
|
|
|
|
/var/lib/dpkg/available. |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=cut |
49
|
|
|
|
|
|
|
sub new { |
50
|
2
|
|
|
2
|
1
|
48
|
my $pkg = shift; |
51
|
2
|
|
|
|
|
68
|
my %p = validate(@_, |
52
|
|
|
|
|
|
|
{ |
53
|
|
|
|
|
|
|
'filename' => { 'type' => SCALAR, 'default' => '/var/lib/dpkg/available', 'optional' => 1 }, |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
); |
56
|
2
|
|
|
|
|
15
|
my $ref = $pkg->next::method('filename' => $p{'filename'}); |
57
|
2
|
|
|
|
|
5
|
return $ref; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
__END__ |