Parse:...ackages(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

✨ NAME ✨

Parse::Debian::Packages β€” bestie, it parses the data from a debian Packages.gz πŸŽ€

(it lives in the User Contributed Perl Documentation section of the 3pm man pages, iykyk)


🌸 SYNOPSIS 🌸

use YAML;
use IO::File;
use Parse::Debian::Packages;
my $fh = IO::File->new("Packages");

my $parser = Parse::Debian::Packages->new( $fh );
while (my %package = $parser->next) {
    print Dump \%package;
}

look at that. clean. gorgeous. no notes. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so this module parses the Packages files that the debian package management tools use. it's giving infrastructure. it's giving backbone of your entire apt situation.

it presents itself as an iterator, which is just a fancy way of saying it hands you one thing at a time. every single time you call the ->next method, you get the next package found in the file. one at a time. no giant array dumped in your lap. slay.

and for laziness (affectionate β€” we love laziness here), we take a filehandle in to the constructor. so like… you open the file for us, bestie. that's your job. we're not gonna do it. 🫢


πŸ’– METHODS πŸ’–

πŸ’… new( $filehandle )

the constructor. hand it a filehandle. that's the whole vibe.

⭐ next

iterate to the next package in the file. it returns either a hash containing a package description, or false at end of file.

so like, while (my %package = $parser->next) and you're off. when it runs out, it goes false, the loop ends, everyone goes home happy. πŸ‘‘

🌈 as_hash( $filehandle )

return all the packages from a filehandle as a hash of hashes. the whole thing. all at once. main character energy, honestly.


πŸ‘‘ AUTHOR πŸ‘‘

Richard Clamp <richardc@unixbeard.net>, with the as_hash implementation by Thomas Klausner. πŸ’œ


Copyright (C) 2003,2005,2012 Richard Clamp. All Rights Reserved.

this module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

fr fr, check the license terms before you go redistributing anything. 🫑

🌟 SEE ALSO 🌟

  • Module::Packaged

that's the whole page, bestie, no cap. πŸ’–

this lil masterpiece shipped as part of perl v5.36.0, dated 2022-11-19, and it's filed under Parse:...ackages(3pm). go parse some packages, you absolute icon βœ¨πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from