DPKG::Parse::Entry - Parse a Package style entry
my $data = <<EOH;
Maintainer: Jamie Heilman <email@example.com>
Depends: coreutils | fileutils (>= 4.0)
Suggests: lilo (>= 19.1) | grub, fdutils, kernel-doc-184.108.40.206 | kernel-source-220.127.116.11
Provides: kernel-image, kernel-image-2.6
Description: Linux kernel binary image for version 18.104.22.168.
my $entry = DPKG::Parse::Entry->new('data' => $data);
print $entry->package . " " . $entry->version . "\n";
DPKG::Parse::Entry parses a dpkg "Package" file entry, creating a new
DPKG::Parse::Entry instance for it. You submit the contents, beginning with a
"Package:" line, as the 'data' argument to new. After that, all the
data is populated as lowercased instance methods. For example, if we used the
above to create an $entry object, we would have:
$entry->package == "kernel-image-22.214.171.124"
$entry->size == 4293154
$entry->md5sum == 2acf846b127b71a1fa1143214b2b85a9
DPKG::Parse::Entry will skip any attribute it does not know about. You can see
what it has skipped by passing a true value to the 'debug' option to '
It should know all the attributes present in a Packages, available, and status
See DPKG::Parse::Status, DPKG::Parse::Available, and DPKG::Parse::Packages for
more information on how to easily generate DPKG::Parse::Entry objects.
- Accessor Methods
- The following accessor methods correspond directly to the
values found in the parsed Package block, with one exception:
"-" characters are replaced with "_". So,
"build-essential" becomes "build_essential".
The accessors are:
- new('data' => $data, 'debug' => 1)
- Creates a new DPKG::Parse::Entry object. 'data' should be a
scalar that contains the text of a dpkg-style Package entry. If the
'debug' flag is set, we will Carp about entries we don't have accessors
- parse('data' => $data);
- Does the actual parsing of the Package block given to
new(). Probably should only be called once per object.