Packag...::Index(3pm)

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

πŸ’– Package::Locator::Index πŸ’–

okay bestie, listen up β€” this is a page from the User Contributed Perl Documentation (yes, the 3pm crew), and it's literally the whole manual for Package::Locator::Index. Buckle up, we're reading a manpage together and it's gonna be cute. πŸŽ€


✨ NAME ✨

Package::Locator::Index β€” the package index of a repository πŸ—‚οΈ

🌸 VERSION 🌸

version 0.010

πŸ¦‹ SYNOPSIS πŸ¦‹

use Package::Locator::Index;

my $index = Package::Locator::Index->new( repository_url => 'http://somewhere' );
my $dist  = $index->distributions->{'A/AU/AUTHOR/Foo-Bar-1.0.tar.gz'};
my $pkg   = $index->packages->{'Foo::Bar'};

πŸ’… DESCRIPTION πŸ’…

so first things first, no cap: this is a private module and there are no user-serviceable parts here. The API docs? They're for the author's own reference only. That's the vibe. πŸ™ˆ

Package::Locator::Index is yet-another module for parsing the contents of the 02packages.details.txt file from a CPAN-like repository. yes bestie, another one. it's giving "I made my own because none of the others understood me". πŸ’€


πŸ”₯ CONSTRUCTOR πŸ”₯

🌈 new( %attributes )

All the attributes listed below can be passed to the constructor, and can be retrieved via accessor methods with the same name. Every single attribute is read-only β€” once the object is constructed you cannot change them. periodt. πŸ”’


πŸ‘‘ ATTRIBUTES πŸ‘‘

⭐ repository_url => 'http://somewhere'

The base URL of the repository you want to get the index from. This is usually a CPAN mirror, but honestly it can be any site or directory that's organized in a CPAN-like structure. This attribute is required β€” no URL, no index, no slay. 🚨

🧚 user_agent => $user_agent_obj

The LWP::UserAgent object that will fetch the index file. If you don't hand one over, a default one gets constructed for you. she's thoughtful like that. 🫢

πŸ“ cache_dir => '/some/directory/path'

The path (as a string or a Path::Class::Dir object) to a directory where the index file will be cached. If the directory doesn't exist, it will be created for you β€” she's proactive. ✨ If you don't specify a cache directory, then a temporary directory will be used, and that temporary directory will be deleted when your application terminates. so like, don't get attached. 😭

πŸ’œ force => $boolean

Causes any cached index files to be removed, thus forcing a new one to be downloaded when the object is constructed. This only has effect if you specified the cache_dir attribute. The default is false. πŸ”₯


πŸŽ€ METHODS πŸŽ€

πŸ’– index_file()

Returns the path to the local copy of the index file (as a Path::Class::File). your little local artifact. iconic.

🌸 distributions

Returns a hashref representing the contents of the index. The keys are the paths to the distributions (as they appear in the index). The values are data structures that look like this:

{
  path     => 'A/AU/AUTHOR/FooBar-1.0.tar.gz',
  source   => 'http://some.cpan.mirror'
  packages => [ ## See package structure below ## ]
}

πŸ¦‹ packages

Returns a hashref representing the contents of the index. The keys are the names of packages. The values are data structures that look like this:

{
  name         => 'Foo',
  version      => '1.0',
  distribution => 'A/AU/AUTHOR/FooBar-1.0.tar.gz'
}

πŸ’€ MOTIVATION πŸ’€

There are numerous existing modules for parsing the 02packages.details.txt file, but the author wasn't completely happy with any of them. Most of the existing modules transform the data into various flavors of Distribution and Package objects. But β€” and this is the whole point β€” they weren't ready to commit to any particular API for Distributions and Packages (not even one of their own πŸ‘€). So Package::Locator::Index exposes the index data as simple data structures. lowkey genius, highkey humble. 🌈


πŸ’œ AUTHOR πŸ’œ

Jeffrey Ryan Thalhammer <jeff@imaginative-software.com>


This software is copyright (c) 2011 by Imaginative Software Systems.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. 🫢


and that's the whole page bestie, every last byte, no details left behind πŸ’…

okay bye, love u β€” this was Package::Locator::Index, page Packag...::Index(3pm), generated by perl v5.34.0 on 2022-06-16. go forth and parse your index. slay. βœ¨πŸ¦‹πŸ‘‘

πŸ“¦ where this page comes from