| CPAN-PackageDetails documentation | Contained in the CPAN-PackageDetails distribution. |
CPAN::PackageDetails::Entry - Handle a single record of 02packages.details.txt.gz
Used internally by CPAN::PackageDetails
An entry is a single line from 02packages.details.txt that maps a package name to a source. It's a whitespace-separated list that has the values for the column identified in the "columns" field in the header.
By default, there are three columns: package name, version, and path.
Inside a CPAN::PackageDetails object, the actual work and
manipulation of the entries are handled by delegate classes specified
in entries_class and entry_class). At the moment these are
immutable, so you'd have to subclass this module to change them.
Create a new entry
Access values of the entry.
Formats the Entry as text. It joins with whitespace the values for the column names you pass it. You get the newline automatically.
Any values that are not defined (or the empty string) turn into the literal string 'undef' to preserve the columns in the output.
This source is in Github:
http://github.com/briandfoy/cpan-packagedetails
brian d foy, <bdfoy@cpan.org>
Copyright (c) 2009, brian d foy, All Rights Reserved.
You may redistribute this under the same terms as Perl itself.
| CPAN-PackageDetails documentation | Contained in the CPAN-PackageDetails distribution. |
package CPAN::PackageDetails::Entry; use strict; use warnings; use vars qw($VERSION); $VERSION = '0.25'; use Carp;
sub new { my( $class, %args ) = @_; bless { %args }, $class }
sub path { $_[0]->{path} } sub version { $_[0]->{version} } sub package_name { $_[0]->{'package name'} }
sub as_string { my( $self, @columns ) = @_; no warnings 'uninitialized'; # can't check defined() because that let's the empty string through return join( "\t", map { length $self->{$_} ? $self->{$_} : 'undef' } @columns ) . "\n"; }
1;