| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
#!/usr/bin/perl |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Debian::Packages; |
|
4
|
2
|
|
|
2
|
|
68536
|
use Moose; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 NAME |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
Debian::Packages - An interface to a Debian Packages file |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 VERSION |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Version 0.03 |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=cut |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
our $VERSION = '0.03'; |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
use Debian::Packages; |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# create object and pass a Packages file |
|
23
|
|
|
|
|
|
|
my $packages_file = DebianPackages->new(filename => '/var/www/apt/dists/sid/main/binary-i386/Packages'); |
|
24
|
|
|
|
|
|
|
my @packages_array = $packages_file->read; |
|
25
|
|
|
|
|
|
|
print "First found package is $packages_array[0]\n"; |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=cut |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
has 'file' => ( is => 'ro', isa => 'Str', default => 0 ); |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head2 read |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
Read our Packages file, place into an array of newlines. |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=cut |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub read { |
|
38
|
|
|
|
|
|
|
use Perl6::Slurp; |
|
39
|
|
|
|
|
|
|
my ($self) = @_; |
|
40
|
|
|
|
|
|
|
slurp $self->{filename}, {irs => qr/\n\n/xms}; |
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
DebianPackages is an interface to a Debian Packages file. The Debian Packages file is a list of packages |
|
46
|
|
|
|
|
|
|
included in a Debian, or Debian based, distribution. This is the file used by APT and other tools to |
|
47
|
|
|
|
|
|
|
query and install packages on a Debian system. The Packages file is usually created by one of the tools |
|
48
|
|
|
|
|
|
|
that manages a debian package repository, like reprepro or dak for example. It has limited use for end users |
|
49
|
|
|
|
|
|
|
since apt and aptitude are better and more complete tools. |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 AUTHOR |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Jeremiah C. Foster, E<lt>jeremiah@jeremiahfoster.comE<gt> |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Copyright 2009 Jeremiah C. Foster, all rights reserved. |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
|
60
|
|
|
|
|
|
|
under the same terms as Perl itself. |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Parse::Debian::Packages (Does roughly the same thing, but is unmaintained.)_ |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=cut |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
1; # End of Debian::Packages |