CPAN::PackageDetails::PerlHash - Handle the collection of records of 02packages.details.txt.gz
Used internally by CPAN::PackageDetails to store the stuff in a Perl hash.
Creates a new Entries object. This doesn't do anything fancy. To add to it, use
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_onceoption with a true value and you try to add that package twice, the object will die. See
Returns the class that Entries uses to make a new Entry object.
Returns a list of the column names in the entry
- column_index_for( COLUMN )
Returns the list position of the named COLUMN.
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.
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 an entry to the collection. Call this on the
CPAN::PackageDetailsobject and it will take care of finding the right handler.
If you've set
allow_packages_only_onceto a true value (which is the default, too),
add_entrywill 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_listto get just the entries with the highest versions for each package.
- already_added( PACKAGE )
Returns true if there is already an entry for PACKAGE.
Returns a text version of the Entries object. This calls
as_stringon each Entry object, and concatenates the results for all Entry objects.
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.
This source is in Github:
brian d foy,
Copyright (c) 2009-2014, brian d foy, All Rights Reserved.
You may redistribute this under the same terms as Perl itself.