NAME

CPAN::PackageDetails::Redis - Handle the collection of records of 02packages.details.txt.gz

SYNOPSIS

Used internally by CPAN::PackageDetails to store the details in a redis database.

DESCRIPTION

Methods

new

Creates a new Entries object. This doesn't do anything fancy. To add to it, use add_entry.

entry_class => the class to use for each entry object
columns     => the column names, in order that you want them in the output

If you specify the allow_packages_only_once option with a true value and you try to add that package twice, the object will die. See add_entry.

entry_class

Returns the class that Entries uses to make a new Entry object.

columns

Returns a list of the column names in the entry

column_index_for( COLUMN )

Returns the list position of the named COLUMN.

count

Returns the number of entries. This is not the same as the number of lines that would show up in the 02packages.details.txt file since this method counts duplicates as well.

entries

Returns the list of entries as an hash reference. The hash key is the package name.

allow_packages_only_once( [ARG] )

Set or retrieve the value of the allow_packages_only_once setting. It's a boolean.

allow_suspicious_names( [ARG] )

Allow an entry to accept an illegal name. Normally you shouldn't use this, but PAUSE has made bad files before.

disallow_alpha_versions( [ARG] )

Set or retrieve the value of the disallow_alpha_versions settings. It's a boolean.

add_entry

Add an entry to the collection. Call this on the CPAN::PackageDetails object and it will take care of finding the right handler.

If you've set allow_packages_only_once to a true value (which is the default, too), add_entry will die if you try to add another entry with the same package name even if it has a different or greater version. You can set this to a false value and add as many entries as you like then use as_unqiue_sorted_list to get just the entries with the highest versions for each package.

already_added( PACKAGE )

Returns true if there is already an entry for PACKAGE.

as_string

Returns a text version of the Entries object. This calls as_string on each Entry object, and concatenates the results for all Entry objects.

as_unique_sorted_list

In list context, this returns a list of entries sorted by package name and version. Each package exists exactly once in the list and with the largest version number seen.

In scalar context this returns the count of the number of unique entries.

Once called, it caches its result until you add more entries.

get_entries_by_package( PACKAGE )

Returns the entry objects for the named PACKAGE.

get_entries_by_distribution( DISTRIBUTION )

Returns the entry objects for the named DISTRIBUTION.

get_entries_by_version( VERSION )

Returns the entry objects for any entries with VERSION.

get_entries_by_path( PATH )

Returns the entry objects for any entries with PATH.

TO DO

SEE ALSO

SOURCE AVAILABILITY

This source is in Github:

https://github.com/briandfoy/cpan-packagedetails

AUTHOR

brian d foy, <bdfoy@cpan.org>

COPYRIGHT AND LICENSE

Copyright © 2009-2021, brian d foy <bdfoy@cpan.org>. All rights reserved.

You may redistribute this under the terms of the Artistic License 2.0.