CPAN::PackageDetails::Header - Handle the header of 02packages.details.txt.gz
Used internally by CPAN::PackageDetails
The 02packages.details.txt.gz header is a short preamble that give information about the creation of the file, its intended use, and the number of entries in the file. It looks something like:
File: 02packages.details.txt URL: http://www.perl.com/CPAN/modules/02packages.details.txt Description: Package names found in directory $CPAN/authors/id/ Columns: package name, version, path Intended-For: Automated fetch routines, namespace documentation. Written-By: Id: mldistwatch.pm 1063 2008-09-23 05:23:57Z k Line-Count: 59754 Last-Updated: Thu, 23 Oct 2008 02:27:36 GMT
Note that there is a Columns field. This module tries to respect the ordering of columns in there. The usual CPAN tools expect only three columns and in the order in this example, but
CPAN::PackageDetails tries to handle any number of columns in any order.
- new( HASH )
Create a new Header object. Unless you want a lot of work so you get more control, just let
readhandle this for you.
In most cases, you'll want to create the Entries object first then pass a reference the the Entries object to
newsince the header object needs to know how to get the count of the number of entries so it can put it in the "Line-Count" header.
CPAN::PackageDetails::Header->new( _entries => $entries_object, )
Write the date in PAUSE format. For example:
Thu, 23 Oct 2008 02:27:36 GMT
Returns a list of the the headers that should show up in the file. This excludes various fake headers stored in the object.
Add an entry to the collection. Call this on the
CPAN::PackageDetailsobject and it will take care of finding the right handler.
- header_exists( FIELD )
Returns true if the header has a field named FIELD, regardless of its value.
- get_header( FIELD )
Returns the value for the named header FIELD. Carps and returns nothing if the named header is not in the object. This method is available from the
$package_details->get_header( 'url' ); $package_details->header->get_header( 'url' );
The header names in the Perl code are in a different format than they are in the file. See
default_headersfor an explanation of the difference.
For most headers, you can also use the header name as the method name:
Returns the columns name as a list (rather than a comma-joined string). The list is in the order of the columns in the output.
Return the header formatted as a string.
This source is in Github:
brian d foy,
Copyright © 2009-2018, brian d foy <email@example.com>. All rights reserved.
You may redistribute this under the terms of the Artistic License 2.0.