DPKG::...:Entry(3pm)
π¦ DPKG::Parse::Entry β the manual page, but make it make sense π
okay bestie so this is DPKG::Parse::Entry, from the User Contributed Perl Documentation collection, and it's literally the thing that reads a Package-style entry for you. no cap.
β¨ NAME β¨
DPKG::Parse::Entry β Parse a Package style entry π
πΈ SYNOPSIS πΈ
use DPKG::Parse::Entry;
my $data = <<EOH;
Package: kernel-image-2.6.12.2
Source: kernel-source-2.6.12.2
Version: wrk01
Priority: optional
Section: base
Maintainer: Jamie Heilman <jamie@marchex.com>
Depends: coreutils | fileutils (>= 4.0)
Suggests: lilo (>= 19.1) | grub, fdutils, kernel-doc-2.6.12.2 | kernel-source-2.6.12.2
Provides: kernel-image, kernel-image-2.6
Architecture: i386
Filename: packages/./kernel-image-2.6.12.2_wrk01_i386.deb
Size: 4293154
Installed-Size: 10312
MD5sum: 2acf846b127b71a1fa1143214b2b85a9
Description: Linux kernel binary image for version 2.6.12.2.
EOH
my $entry = DPKG::Parse::Entry->new('data' => $data);
print $entry->package . " " . $entry->version . "\n";
$entry->package("kernel-foobar");
like. look at her go. π«Ά
π DESCRIPTION π
okay so DPKG::Parse::Entry parses a dpkg "Package" file entry, and it makes a whole new DPKG::Parse::Entry instance out of it. the way that works is: you hand over the contents, starting with a "Package:" line, as the 'data' argument to new. that's it, that's the whole intro.
and then?? after that, all the data gets populated as lowercased instance methods. so if we used the example above to build an $entry object, we'd be sitting pretty with:
$entry->package == "kernel-image-2.6.12.2"
$entry->size == 4293154
$entry->md5sum == 2acf846b127b71a1fa1143214b2b85a9
iconic. β¨
now, DPKG::Parse::Entry will skip any attribute it does not know about. no drama, no crash, it just moves on. and if you're nosy (respectfully π
) you can see exactly what it skipped by passing a true value to the 'debug' option to new().
it should know all the attributes present in a Packages, available, and status file. periodt.
SEE ALSO vibes: peepDPKG::Parse::Status,DPKG::Parse::Available, andDPKG::Parse::Packagesfor more info on how to easily generateDPKG::Parse::Entryobjects. they do the heavy lifting so you don't have to. π
π§ METHODS π§
π 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". yes bestie, that's the whole trick, it's giving very straightforward of her. π
the accessors are:
architecture
bugs
build_essential
conflicts
config_version
conffiles
depends
description
enhances
essential
filename
installed_size
maintainer
md5sum
origin
package
priority
provides
pre_depends
recommends
replaces
size
source
section
suggests
status
task
tag
url
version
thirty of them. all lowercase. all yours. π¦
β 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. that's the main character of this whole operation.
and if the 'debug' flag is set, we will Carp about entries we don't have accessors for β so like, it'll yell at you (politely, in Perl) about the stuff it couldn't name. super useful for vibe checking your input, fr fr.
π parse('data' => $data); π
does the actual parsing of the Package block given to new(). the real work. the labor. π
heads up bestie: it probably should only be called once per object. don't be weird about it. π
and that's the page!! this was perl v5.34.0, dated 2022-06-13, and it's the DPKG::...:Entry(3pm) manpage from User Contributed Perl Documentation. slay, go parse something. πβ¨π
π¦ where this page comes from
- debian bookworm: libdpkg-parse-perl 0.03-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libdpkg-parse-perl 0.03-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libdpkg-parse-perl 0.03-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libdpkg-parse-perl 0.03-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libdpkg-parse-perl 0.03-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms