DPKG::Parse(3pm)

πŸ“¦
version 0.03 Β· 2 versions
  • 0.03 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 0.03 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– 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 generic new function; it takes a filename and calls the filename() 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 calls parse_package_format. a little delegation moment, we love to see it.
  • parse_package_format β€” takes a file in a format similar to the dpkg available file, and creates DPKG::Parse::Entry objects 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 the entryhash accessor, but you can override that with the hash parameter. usually it hands you back a DPKG::Parse::Entry object. πŸŽ€
  • next_package β€” shifts the next value off the array stored in the entryarray() 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