DPKG::Parse(3pm)
π DPKG::Parse β bestie edition π
okay so this is DPKG::Parse, from the User Contributed Perl Documentation, and it's literally the module that takes your dpkg files and turns them into cute little Perl objects. No cap. π«Ά
β¨ NAME β¨
DPKG::Parse β parse various dpkg files into Perl Objects. That's the whole job, and it does it flawlessly. π
πΈ SYNOPSIS πΈ
bestie, here's the vibe:
use DPKG::Parse::Status;
my $status = DPKG::Parse::Status->new;
while (my $entry = $status->next_package) {
print $entry->package . " " . $entry->version . "\n";
}
use DPKG::Parse::Available;
my $available = DPKG::Parse::Available->new;
while (my $entry = $available->next_package) {
print $entry->package . " " . $entry->version . "\n";
}
like, look at her go. looping through packages and printing names and versions. main character energy fr fr. π
π¦ DESCRIPTION π¦
DPKG::Parse is full of utilities that parse all the various files dpkg creates and turn them into super helpful Perl objects. it's giving "glow up for your package metadata," honestly. π
here are the files the various DPKG::Parse modules currently understand:
/var/lib/dpkg/status - DPKG::Parse::Status
/var/lib/dpkg/available - DPKG::Parse::Available
Packages.gz - DPKG::Parse::Packages
check each module's own documentation for the specifics, bestie β you should NOT be calling DPKG::Parse directly. it's the parent, not the star of the show. let the children do their thing. π
π METHODS π
filename($filename)β a simple accessor for whatever file is currently being parsed. lowkey does exactly what it says on the tin.entryarrayβ gives you access to the raw array of entries in a given file. raw. unfiltered. iconic. β¨entryhashβ gives you access to the raw hash of entries. the key is decided by the module, but it's usually the Package name. iykyk. πnew('filename' => '/var/lib/dpkg/status')β a genericnewfunction; it takes a filename and calls thefilename()accessor with it. don't call this one directly, bestie β go through one of the children of this package instead. it's a nepo baby, it needs its family. πparseβ the default parse function; it just callsparse_package_format. a little delegation moment, we love to see it.parse_package_formatβ takes a file in a format similar to the dpkgavailablefile, and createsDPKG::Parse::Entryobjects from each entry. factory behavior. ate. π₯get_package('name' => 'postfix', 'hash' => 'entryhash')β grabs the value of a hash, if it exists. by default it uses the value returned by theentryhashaccessor, but you can override that with thehashparameter. usually it hands you back aDPKG::Parse::Entryobject. πnext_packageβ shifts the next value off the array stored in theentryarray()accessor. if you want to access the raw values, do NOT use this function! it shifts! the array is getting shorter every time you call it, no take-backs. π
π SEE ALSO π
DPKG::Parse::Status, DPKG::Parse::Available, DPKG::Parse::Packages, DPKG::Parse::Entry
go read them, bestie. they're the supporting cast and they understood the assignment. π
π AUTHOR π
Adam Jacob, "holoway@cpan.org" π
β LICENSE β
This library is free software. You can redistribute it and/or modify it under the same terms as perl itself. slay, honestly. π§
cute little sign-off: this page came to you as part of perl v5.34.0, dated 2022-06-13, and yes it's the DPKG::Parse(3pm) page. mwah. π
π¦ 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