Debian...ontents(3pm)
okay bestie, gather round π today's main character is the manual page Debian...ontents(3pm), straight out of the User Contributed Perl Documentation collection. yeah, that's the whole page name β she's a little mysterious like that β¨ and she's here to help you parse and search through apt-file's Contents files. let's get into it, no cap.
πΈ NAME πΈ
Debian::AptContents β parse/search through apt-file's Contents files
literally exactly what it says on the tin, bestie. she parses, she searches, she slays.
π¦ SYNOPSIS π¦
my $c = Debian::AptContents->new( { cache_dir => '~/.cache/dh-make-perl' } );
my @pkgs = $c->find_file_packages('/usr/bin/foo');
my $dep = $c->find_perl_module_package('Foo::Bar');
that's the vibe. make an object, ask it which packages own a file, ask it which package gives you a Perl module. chef's kiss. π
π TODO π
okay so lowkey there's some unfinished business on this page and we're gonna be honest about it:
- This needs to really work not only for Perl modules. (it's giving very Perl-module-specific right now and that's the tea π)
- A module specific to Perl modules is needed by
dh-make-perl, but it can subclassDebian::AptContents, which needs to become more generic.
so like, the glow-up is planned, we just haven't gotten there yet. periodt.
π CONSTRUCTOR π
newβ Constructs a new instance of the class. Expects at least thecache_diroption, so don't come to this party empty-handed, queen. π«Ά
β¨ FIELDS β¨
cache_dirβ (mandatory, btw, like actually required) the directory where the object stores its cache.homedirβ a legacy option to specify the cache directory. old-school cool, still valid. β¨distβ used for filtering on the"distributon"part of the repository paths listed insources.list. Default is empty, meaning no filtering β everyone's welcome, the door's open.contents_filesβ an arrayref of Contents file names. Default is to just let apt-file find them. she handles it, don't worry.cache_fileβ path to the file with cached parsed information from all Contents files. Default isContents.cacheundercache_dir.cacheβ filled byread_cache. Used byfind_file_packagesand (obviously)store_cache. obviously. πverboseβ verbosity level.0means silent, and the bigger the number the more the jabber. Default is1.
π OBJECT METHODS π
warningβ used internally. Given a verbosity level and a message, prints the message toSTDERRif the verbosity level is greater than or equal of the value ofverbose. internal queen, doing internal things.get_contents_filesβ readssources.list, gives the repository paths torepo_source_to_contents_paths, and returns an arrayref of file names of Contents files.read_cacheβ reads the cached parsed Contents files. If there are Contents files with more recentmtimethan that of the cache (or if there is no cache at all), parses all Contents and stores the cache viastore_cachefor later invocation. efficient? we love to see it. πstore_cacheβ writes the contents of the parsedcacheto thecache_file.Storableis used to stream the data, and along with the information from Contents files, a time stamp is stored too. β°find_file_packagesβ returns a list of packages where the given file was found. Contents files store the package section together with the package name, and that part gets stripped off. Returns an empty list if the file is not found in any package. π we've all been that file.find_perl_module_package( $module, $version )β given a Perl module name (e.g.Foo::Bar), returns aDebian::Dependencyobject representing the required Debian package and version. If the module is only in perl core, a suitable dependency on perl is returned. For dual-lived modules β the ones that live in perl and in a separate package β only the latter is returned, since the perl package has versionedProvidesfor them. she knows what she's doing, trust. π§
π«Ά AUTHOR π«Ά
- Damyan Ivanov <dmn@debian.org>
- gregor herrmann <gregoa@debian.org>
the icons who built this. respect. π
π COPYRIGHT & LICENSE π
Copyright (C) 2008, 2009, 2010, 2017 Damyan Ivanov <dmn@debian.org> Copyright (C) 2016, 2019 gregor herrmann <gregoa@debian.org>
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
and that's the whole page, bestie π ty for coming to my TED talk. this one shipped as perl v5.40.1, dated 2026-05-08, and yes the page name is literally Debian...ontents(3pm) β she contains multitudes, we stay obsessed. π
π¦ where this page comes from
- ubuntu stonking: dh-make-perl 0.133 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms