NAME

CPAN::PackageDetails::Header - Handle the header of 02packages.details.txt.gz

SYNOPSIS

Used internally by CPAN::PackageDetails

DESCRIPTION

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.

Methods

new( HASH )

Create a new Header object. Unless you want a lot of work so you get more control, just let CPAN::PackageDetails's new or read handle this for you.

In most cases, you'll want to create the Entries object first then pass a reference the the Entries object to new since 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,
	)
format_date

Write the date in PAUSE format. For example:

Thu, 23 Oct 2008 02:27:36 GMT
default_headers

Returns a list of the the headers that should show up in the file. This excludes various fake headers stored in the object.

set_header

Add an entry to the collection. Call this on the CPAN::PackageDetails object 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 CPAN::PackageDetails or CPAN::PackageDetails::Header object:

$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_headers for an explanation of the difference.

For most headers, you can also use the header name as the method name:

$package_details->header->url;
columns_as_list

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.

as_string

Return the header formatted as a string.

TO DO

SEE ALSO

SOURCE AVAILABILITY

This source is in Github:

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

AUTHOR

brian d foy, <briandfoy@pobox.com>

COPYRIGHT AND LICENSE

Copyright © 2009-2024, brian d foy <briandfoy@pobox.com>. All rights reserved.

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