logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Package::Locator::Index - The package index of a repository

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 can be
       any site or directory that is organized in a CPAN-like structure.  This attribute is required.

   user_agent=>$user_agent_obj
       The LWP::UserAgent object that will fetch the index file.  If you do not provide a user agent, then a
       default one will be constructed for you.

   cache_dir=>'/some/directory/path'
       The path (as a string or Path::Class::Dir object) to a directory where the index file will be cached.  If
       the directory does not exist, it will be created for you.  If you do not specify a cache directory, then
       a temporary directory will be used.  The temporary directory will be deleted when your application
       terminates.

   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.

Author

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

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.  All attributes are read-only, and cannot be changed once the object is
       constructed.

Description

Thisisaprivatemoduleandtherearenouser-serviceablepartshere.TheAPIdocumentationisformyownreferenceonly.

       Package::Locator::Index is yet-another module for parsing the contents of the 02packages.details.txt file
       from a CPAN-like repository.

Methods

index_file()
       Returns the path to the local copy of the index file (as a Path::Class::File).

   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 I 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 I'm not ready to commit to any particular API for Distributions and
       Packages (not even one of my own).  So Package::Locator::Index exposes the index data as simple data
       structures.

Name

       Package::Locator::Index - The package index of a repository

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'};

Version

       version 0.010

See Also