'CPAN::Meta' =>
{
'MAINTAINER' => 'dagolden',
- 'DISTRIBUTION' => 'DAGOLDEN/CPAN-Meta-2.110930.tar.gz',
+ 'DISTRIBUTION' => 'DAGOLDEN/CPAN-Meta-2.112150.tar.gz',
'FILES' => q[cpan/CPAN-Meta],
'EXCLUDED' => [
qr/^xt/,
Revision history for CPAN-Meta
+2.112150 2011-08-02 22:25:41 America/New_York
+
+ [BUGFIX]
+
+ - Stringify any objects encountered during conversion. (RT #67295)
+
+ - Fixed some broken URLs in documentation and for LGPL in legacy
+ conversion (RT #68738)
+
+ - Fixed invalid private Pod in CPAN::Meta::Validator (RT #65925)
+
+ [SPEC]
+
+ - Clarified that file paths in the 'provides' section must be in
+ Unix-style (i.e. forward slashes) (RT #69045)
+
+ - Replaced examples using Module::Build::ModuleInfo with Module::Metadata
+ (RT #66135)
+
2.110930 2011-04-02 23:31:24 America/New_York
[BUGFIX]
use strict;
use warnings;
package CPAN::Meta;
-BEGIN {
- $CPAN::Meta::VERSION = eval '2.110930_001';
-}
-# ABSTRACT: the distribution metadata for a CPAN dist
+our $VERSION = '2.112150'; # VERSION
use Carp qw(carp croak);
use CPAN::Meta::Validator;
use Parse::CPAN::Meta 1.4400 ();
-sub _dclone {
- CPAN::Meta::Converter::_dclone(@_);
-}
+BEGIN { *_dclone = \&CPAN::Meta::Converter::_dclone }
BEGIN {
1;
+# ABSTRACT: the distribution metadata for a CPAN dist
+
=pod
=head1 VERSION
-version 2.110930
+version 2.112150
=head1 SYNOPSIS
If a custom key refers to a data structure, a deep clone is returned.
+=for Pod::Coverage TO_JSON abstract author authors custom custom_keys description dynamic_config
+generated_by keywords license licenses meta_spec name no_index
+optional_features prereqs provides release_status resources version
+
=head1 BUGS
Please report any bugs or feature using the CPAN Request Tracker.
=back
+=for :stopwords cpan testmatrix url annocpan anno bugtracker rt cpants kwalitee diff irc mailto metadata placeholders
+
+=head1 SUPPORT
+
+=head2 Bugs / Feature Requests
+
+Please report any bugs or feature requests by email to C<bug-cpan-meta at rt.cpan.org>, or through
+the web interface at L<http://rt.cpan.org/Public/Dist/Display.html?Name=CPAN-Meta>. You will be automatically notified of any
+progress on the request by the system.
+
+=head2 Source Code
+
+This is open source software. The code repository is available for
+public review and contribution under the terms of the license.
+
+L<http://github.com/dagolden/cpan-meta>
+
+ git clone git://github.com/dagolden/cpan-meta.git
+
=head1 AUTHORS
=over 4
use strict;
use warnings;
package CPAN::Meta::Converter;
-BEGIN {
- $CPAN::Meta::Converter::VERSION = eval '2.110930_001';
-}
-# ABSTRACT: Convert CPAN distribution metadata structures
+our $VERSION = '2.112150'; # VERSION
use CPAN::Meta::Validator;
use version 0.82 ();
use Parse::CPAN::Meta 1.4400 ();
-use Carp qw(croak);
sub _dclone {
my $ref = shift;
- # Work around JSON::PP's lack of a convert_blessed_universally
- local *UNIVERSAL::TO_JSON = sub {
- my $obj = shift;
-
- # Special case: stringify version objects
- # Everything else: serialize
- return $obj->isa("version") ? "$obj" :
- $obj->isa("HASH") ? { %$obj } :
- $obj->isa("ARRAY") ? { @$obj } :
- croak "Don't know how to serialize $obj";
- };
+ # if an object is in the data structure and doesn't specify how to
+ # turn itself into JSON, we just stringify the object. That does the
+ # right thing for typical things that might be there, like version objects,
+ # Path::Class objects, etc.
+ no warnings 'once';
+ local *UNIVERSAL::TO_JSON = sub { return "$_[0]" };
my $backend = Parse::CPAN::Meta->json_backend();
return $backend->new->decode(
- $backend->new->convert_blessed->allow_blessed->encode($ref)
+ $backend->new->allow_blessed->convert_blessed->encode($ref)
);
}
-
my %known_specs = (
'2' => 'http://search.cpan.org/perldoc?CPAN::Meta::Spec',
'1.4' => 'http://module-build.sourceforge.net/META-spec-v1.4.html',
1;
+# ABSTRACT: Convert CPAN distribution metadata structures
+
=pod
=head1 VERSION
-version 2.110930
+version 2.112150
=head1 SYNOPSIS
use strict;
use warnings;
package CPAN::Meta::Feature;
-BEGIN {
- $CPAN::Meta::Feature::VERSION = '2.110930';
-}
-# ABSTRACT: an optional feature provided by a CPAN distribution
+our $VERSION = '2.112150'; # VERSION
use CPAN::Meta::Prereqs;
1;
+# ABSTRACT: an optional feature provided by a CPAN distribution
+
=pod
=head1 VERSION
-version 2.110930
+version 2.112150
=head1 DESCRIPTION
use strict;
use warnings;
package CPAN::Meta::History;
-BEGIN {
- $CPAN::Meta::History::VERSION = '2.110930';
-}
-# ABSTRACT: history of CPAN Meta Spec changes
+our $VERSION = '2.112150'; # VERSION
+
1;
+# ABSTRACT: history of CPAN Meta Spec changes
+
__END__
=head1 VERSION
-version 2.110930
+version 2.112150
=head1 DESCRIPTION
use strict;
use warnings;
package CPAN::Meta::Prereqs;
-BEGIN {
- $CPAN::Meta::Prereqs::VERSION = '2.110930';
-}
-# ABSTRACT: a set of distribution prerequisites by phase and type
+our $VERSION = '2.112150'; # VERSION
use Carp qw(confess);
1;
+# ABSTRACT: a set of distribution prerequisites by phase and type
+
=pod
=head1 VERSION
-version 2.110930
+version 2.112150
=head1 DESCRIPTION
use strict;
use warnings;
package CPAN::Meta::Spec;
-BEGIN {
- $CPAN::Meta::Spec::VERSION = '2.110930';
-}
-# ABSTRACT: specification for CPAN distribution metadata
+our $VERSION = '2.112150'; # VERSION
+
1;
+# ABSTRACT: specification for CPAN distribution metadata
+
__END__
=head1 VERSION
-version 2.110930
+version 2.112150
=head1 SYNOPSIS
=item file
-This field is required. The value must contain a relative file path
-from the root of the distribution to the module containing the package.
+This field is required. The value must contain a Unix-style relative
+file path from the root of the distribution to the module containing the
+package.
=item version
license => [ 'http://dev.perl.org/licenses/' ],
homepage => 'http://sourceforge.net/projects/module-build',
bugtracker => {
- web => 'http://github.com/dagolden/cpan-meta-spec/issues',
+ web => 'http://rt.cpan.org/Public/Dist/Display.html?Name=CPAN-Meta',
mailto => 'meta-bugs@example.com',
},
repository => {
- url => 'git://github.com/dagolden/cpan-meta-spec.git',
- web => 'http://github.com/dagolden/cpan-meta-spec',
+ url => 'git://github.com/dagolden/cpan-meta.git',
+ web => 'http://github.com/dagolden/cpan-meta',
type => 'git',
},
x_twitter => 'http://twitter.com/cpan_linked/',
=head2 Extracting Version Numbers from Perl Modules
To get the version number from a Perl module, consumers should use the
-C<< MM->parse_version($file) >> method provided by L<ExtUtils::MakeMaker> or
-the L<Module::Build::ModuleInfo> module provided with L<Module::Build>. For
-example, for the module given by C<$mod>, the version may be retrieved in one
-of the following ways:
+C<< MM->parse_version($file) >> method provided by
+L<ExtUtils::MakeMaker> or L<Module::Metadata>. For example, for the
+module given by C<$mod>, the version may be retrieved in one of the
+following ways:
# via ExtUtils::MakeMaker
my $file = MM->_installed_file_for_module($mod);
The private C<_installed_file_for_module> method may be replaced with
other methods for locating a module in C<@INC>.
- # via Module::Build
- my $info = Module::Build::ModuleInfo->new_from_module($mod);
+ # via Module::Metadata
+ my $info = Module::Metadata->new_from_module($mod);
my $version = $info->version;
If only a filename is available, the following approach may be used:
# via Module::Build
- my $info = Module::Build::ModuleInfo->new_from_file($file);
+ my $info = Module::Metadata->new_from_file($file);
my $version = $info->version;
=head2 Comparing Version Numbers
use strict;
use warnings;
package CPAN::Meta::Validator;
-BEGIN {
- $CPAN::Meta::Validator::VERSION = '2.110930';
-}
-# ABSTRACT: validate CPAN distribution metadata structures
+our $VERSION = '2.112150'; # VERSION
#--------------------------------------------------------------------------#
'apache' => 'http://apache.org/licenses/LICENSE-2.0',
'artistic' => 'http://opensource.org/licenses/artistic-license.php',
'artistic_2' => 'http://opensource.org/licenses/artistic-license-2.0.php',
- 'lgpl' => 'http://www.opensource.org/licenses/lgpl-license.phpt',
+ 'lgpl' => 'http://www.opensource.org/licenses/lgpl-license.php',
'bsd' => 'http://www.opensource.org/licenses/bsd-license.php',
'gpl' => 'http://www.opensource.org/licenses/gpl-license.php',
'mit' => 'http://opensource.org/licenses/mit-license.php',
1;
+# ABSTRACT: validate CPAN distribution metadata structures
+
=pod
=head1 VERSION
-version 2.110930
+version 2.112150
=head1 SYNOPSIS
Returns a list of errors seen during validation.
-=begin internals
+=begin :internals
=head2 Check Methods
=over
-=item * check_map($spec,$data)
+=item *
+
+check_map($spec,$data)
Checks whether a map (or hash) part of the data structure conforms to the
appropriate specification definition.
-=item * check_list($spec,$data)
+
+=item *
+
+check_list($spec,$data)
Checks whether a list (or array) part of the data structure conforms to
the appropriate specification definition.
-=item * check_lazylist($spec,$data)
+
+=item *
+
+check_lazylist($spec,$data)
Checks whether a list conforms, but converts strings to a single-element list
+
=back
=head2 Validator Methods
=over
-=item * header($self,$key,$value)
+=item *
+
+header($self,$key,$value)
Validates that the header is valid.
-Note: No longer used as we now read the data structure, not the file.=item * url($self,$key,$value)
+Note: No longer used as we now read the data structure, not the file.
+
+=item *
+
+url($self,$key,$value)
Validates that a given value is in an acceptable URL format
-=item * urlspec($self,$key,$value)
+
+=item *
+
+urlspec($self,$key,$value)
Validates that the URL to a META specification is a known one.
-=item * string_or_undef($self,$key,$value)
+
+=item *
+
+string_or_undef($self,$key,$value)
Validates that the value is either a string or an undef value. Bit of a
catchall function for parts of the data structure that are completely user
defined.
-=item * string($self,$key,$value)
+
+=item *
+
+string($self,$key,$value)
Validates that a string exists for the given key.
-=item * file($self,$key,$value)
+
+=item *
+
+file($self,$key,$value)
Validate that a file is passed for the given key. This may be made more
thorough in the future. For now it acts like \&string.
-=item * exversion($self,$key,$value)
+
+=item *
+
+exversion($self,$key,$value)
Validates a list of versions, e.g. '<= 5, >=2, ==3, !=4, >1, <6, 0'.
-=item * version($self,$key,$value)
+
+=item *
+
+version($self,$key,$value)
Validates a single version string. Versions of the type '5.8.8' and '0.00_00'
are both valid. A leading 'v' like 'v1.2.3' is also valid.
-=item * boolean($self,$key,$value)
+
+=item *
+
+boolean($self,$key,$value)
Validates for a boolean value. Currently these values are '1', '0', 'true',
'false', however the latter 2 may be removed.
-=item * license($self,$key,$value)
+
+=item *
+
+license($self,$key,$value)
Validates that a value is given for the license. Returns 1 if an known license
type, or 2 if a value is given but the license type is not a recommended one.
-=item * custom_1($self,$key,$value)
+
+=item *
+
+custom_1($self,$key,$value)
Validates that the given key is in CamelCase, to indicate a user defined
keyword and only has characters in the class [-_a-zA-Z]. In version 1.X
of the spec, this was only explicitly stated for 'resources'.
-=item * custom_2($self,$key,$value)
+
+=item *
+
+custom_2($self,$key,$value)
Validates that the given key begins with 'x_' or 'X_', to indicate a user
defined keyword and only has characters in the class [-_a-zA-Z]
-=item * identifier($self,$key,$value)
+
+=item *
+
+identifier($self,$key,$value)
Validates that key is in an acceptable format for the META specification,
for an identifier, i.e. any that matches the regular expression
qr/[a-z][a-z_]/i.
-=item * module($self,$key,$value)
+
+=item *
+
+module($self,$key,$value)
Validates that a given key is in an acceptable module name format, e.g.
'Test::CPAN::Meta::Version'.
+
=back
-=end internals
+=end :internals
+
+=for Pod::Coverage anything boolean check_lazylist check_list custom_1 custom_2 exversion file
+identifier license module phase relation release_status string string_or_undef
+url urlspec version header check_map
=head1 BUGS
use File::Spec;
use IO::Dir;
use Parse::CPAN::Meta 1.4400;
+use version;
+
+# mock file object
+package
+ File::StringObject;
+
+use overload q{""} => sub { ${$_[0]} }, fallback => 1;
+
+sub new {
+ my ($class, $file) = @_;
+ bless \$file, $class;
+}
+
+package main;
my $data_dir = IO::Dir->new( 't/data' );
my @files = sort grep { /^\w/ } $data_dir->read;
);
}
-done_testing;
+# specific test for object conversion
+{
+ my $path = File::Spec->catfile('t','data','resources.yml');
+ my $original = Parse::CPAN::Meta->load_file( $path );
+ ok( $original, "loaded resources.yml" );
+ $original->{version} = version->new("1.64");
+ $original->{no_index}{file} = File::StringObject->new(".gitignore");
+ pass( "replaced some data fields with objects" );
+ my $cmc = CPAN::Meta::Converter->new( $original );
+ ok( my $converted = $cmc->convert( version => 2 ), "conversion successful" );
+}
+done_testing;
=item *
+L<CPAN::Meta> has been upgraded from version 2.110930_001 to version 2.112150
+
+Stringify any objects encountered during conversion.
+
+Clarified that file paths in the 'provides' section must be in
+Unix-style (i.e. forward slashes)
+
+=item *
+
L<ExtUtils::Install> has been upgraded from version 1.56 to version 1.57.
There is no change to ExtUtils::Install other than the version number