cpan/CPAN/t/03pkgs.t See if CPAN::Version works
cpan/CPAN/t/10version.t See if CPAN the module works
cpan/CPAN/t/11mirroredby.t See if CPAN::Mirrored::By works
+cpan/CPAN-Meta/corpus/BadMETA.yml
+cpan/CPAN-Meta/corpus/bareyaml.meta
+cpan/CPAN-Meta/corpus/CL018_yaml.meta
+cpan/CPAN-Meta/corpus/json.meta
+cpan/CPAN-Meta/corpus/META-VR.json
+cpan/CPAN-Meta/corpus/META-VR.yml
+cpan/CPAN-Meta/corpus/yaml.meta
cpan/CPAN-Meta/lib/CPAN/Meta.pm
cpan/CPAN-Meta/lib/CPAN/Meta/Converter.pm
cpan/CPAN-Meta/lib/CPAN/Meta/Feature.pm
cpan/CPAN-Meta/lib/CPAN/Meta/Prereqs.pm
cpan/CPAN-Meta/lib/CPAN/Meta/Spec.pm
cpan/CPAN-Meta/lib/CPAN/Meta/Validator.pm
+cpan/CPAN-Meta/lib/Parse/CPAN/Meta.pm
cpan/CPAN-Meta/t/converter.t
cpan/CPAN-Meta/t/converter-bad.t
cpan/CPAN-Meta/t/converter-fail.t
cpan/CPAN-Meta/t/data-test/version-not-normal.json
cpan/CPAN-Meta/t/data-test/version-ranges-1_4.yml
cpan/CPAN-Meta/t/data-test/version-ranges-2.json
+cpan/CPAN-Meta/t/data-test/x_deprecated-META.json
cpan/CPAN-Meta/t/data-valid/1122575719-META.yml
cpan/CPAN-Meta/t/data-valid/1206545041-META.yml
cpan/CPAN-Meta/t/data-valid/1985684504-META.yml
cpan/CPAN-Meta/t/data-valid/476602558-META.yml
cpan/CPAN-Meta/t/data-valid/META-1_0.yml
cpan/CPAN-Meta/t/data-valid/META-1_1.yml
+cpan/CPAN-Meta/t/data-valid/META-1_4.yml
+cpan/CPAN-Meta/t/data-valid/META-2.json
cpan/CPAN-Meta/t/data-valid/scalar-meta-spec.yml
+cpan/CPAN-Meta/t/data-valid/x_deprecated-META.yml
+cpan/CPAN-Meta/t/lib/Parse/CPAN/Meta/Test.pm
cpan/CPAN-Meta/t/load-bad.t
cpan/CPAN-Meta/t/merge.t
cpan/CPAN-Meta/t/meta-obj.t
cpan/CPAN-Meta/t/no-index.t
cpan/CPAN-Meta/t/optional_feature-merge.t
+cpan/CPAN-Meta/t/parse-cpan-meta/02_api.t
+cpan/CPAN-Meta/t/parse-cpan-meta/03_functions.t
+cpan/CPAN-Meta/t/parse-cpan-meta/04_export.t
+cpan/CPAN-Meta/t/parse-cpan-meta/05_errors.t
cpan/CPAN-Meta/t/prereqs.t
cpan/CPAN-Meta/t/prereqs-finalize.t
cpan/CPAN-Meta/t/prereqs-merge.t
+cpan/CPAN-Meta/t/README-data.txt
cpan/CPAN-Meta/t/repository.t
cpan/CPAN-Meta/t/save-load.t
cpan/CPAN-Meta/t/validator.t
cpan/parent/t/parent-classfromfile.t tests for parent.pm
cpan/parent/t/parent-pmc.t tests for parent.pm
cpan/parent/t/parent-returns-false.t tests for parent.pm
-cpan/Parse-CPAN-Meta/corpus/BadMETA.yml
-cpan/Parse-CPAN-Meta/corpus/bareyaml.meta
-cpan/Parse-CPAN-Meta/corpus/CL018_yaml.meta
-cpan/Parse-CPAN-Meta/corpus/json.meta
-cpan/Parse-CPAN-Meta/corpus/META-VR.json
-cpan/Parse-CPAN-Meta/corpus/META-VR.yml
-cpan/Parse-CPAN-Meta/corpus/yaml.meta
-cpan/Parse-CPAN-Meta/lib/Parse/CPAN/Meta.pm
-cpan/Parse-CPAN-Meta/t/02_api.t
-cpan/Parse-CPAN-Meta/t/03_functions.t
-cpan/Parse-CPAN-Meta/t/04_export.t
-cpan/Parse-CPAN-Meta/t/05_errors.t
-cpan/Parse-CPAN-Meta/t/lib/Parse/CPAN/Meta/Test.pm
cpan/Perl-OSType/lib/Perl/OSType.pm Perl::OSType
cpan/Perl-OSType/t/OSType.t Perl::OSType
cpan/perlfaq/lib/perlfaq.pm Perl frequently asked questions
# Note: When updating CPAN-Meta the META.* files will need to be regenerated
# perl -Icpan/CPAN-Meta/lib Porting/makemeta
'CPAN::Meta' => {
- 'DISTRIBUTION' => 'DAGOLDEN/CPAN-Meta-2.150005.tar.gz',
+ 'DISTRIBUTION' => 'DAGOLDEN/CPAN-Meta-2.150010.tar.gz',
'FILES' => q[cpan/CPAN-Meta],
'EXCLUDED' => [
qw[t/00-report-prereqs.t
t/00-report-prereqs.dd
- t/data-test/x_deprecated-META.json
- t/data-valid/x_deprecated-META.yml
- t/README-data.txt],
+ ],
qr{^xt},
qr{^history},
],
'FILES' => q[cpan/parent],
},
- 'Parse::CPAN::Meta' => {
- 'DISTRIBUTION' => 'DAGOLDEN/Parse-CPAN-Meta-1.4422.tar.gz',
- 'FILES' => q[cpan/Parse-CPAN-Meta],
- 'EXCLUDED' => [
- qw[t/00-report-prereqs.dd],
- qw[t/00-report-prereqs.t],
- qr{^xt},
- ],
- },
-
'PathTools' => {
'DISTRIBUTION' => 'RJBS/PathTools-3.62.tar.gz',
'FILES' => q[dist/PathTools],
--- /dev/null
+---
+abstract: ~
+author:
+ - 'Olivier Mengué'
+build_requires:
+ ExtUtils::MakeMaker: 6.36
+configure_requires:
+ ExtUtils::MakeMaker: 6.36
+distribution_type: module
+dynamic_config: 1
+generated_by: 'Module::Install version 1.06'
+license: perl
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-v1.4.html
+ version: 1.4
+name: Foo
+no_index:
+ directory:
+ - inc
+requires:
+ perl: 5.005
+resources:
+ license: http://dev.perl.org/licenses/
+version: 0.01
use warnings;
package CPAN::Meta::Converter;
-our $VERSION = '2.150005';
+our $VERSION = '2.150010';
#pod =head1 SYNOPSIS
#pod
# Perl 5.10.0 didn't have "is_qv" in version.pm
*_is_qv = version->can('is_qv') ? sub { $_[0]->is_qv } : sub { exists $_[0]->{qv} };
+# We limit cloning to a maximum depth to bail out on circular data
+# structures. While actual cycle detection might be technically better,
+# we expect circularity in META data structures to be rare and generally
+# the result of user error. Therefore, a depth counter is lower overhead.
+our $DCLONE_MAXDEPTH = 1024;
+our $_CLONE_DEPTH;
+
sub _dclone {
- my $ref = shift;
-
- # 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';
- no warnings 'redefine';
- local *UNIVERSAL::TO_JSON = sub { "$_[0]" };
-
- my $json = Parse::CPAN::Meta->json_backend()->new
- ->utf8
- ->allow_blessed
- ->convert_blessed;
- $json->decode($json->encode($ref))
+ my ( $ref ) = @_;
+ return $ref unless my $reftype = ref $ref;
+
+ local $_CLONE_DEPTH = defined $_CLONE_DEPTH ? $_CLONE_DEPTH - 1 : $DCLONE_MAXDEPTH;
+ die "Depth Limit $DCLONE_MAXDEPTH Exceeded" if $_CLONE_DEPTH == 0;
+
+ return [ map { _dclone( $_ ) } @{$ref} ] if 'ARRAY' eq $reftype;
+ return { map { $_ => _dclone( $ref->{$_} ) } keys %{$ref} } if 'HASH' eq $reftype;
+
+ if ( 'SCALAR' eq $reftype ) {
+ my $new = _dclone(${$ref});
+ return \$new;
+ }
+
+ # We can't know if TO_JSON gives us cloned data, so refs must recurse
+ if ( eval { $ref->can('TO_JSON') } ) {
+ my $data = $ref->TO_JSON;
+ return ref $data ? _dclone( $data ) : $data;
+ }
+
+ # Just stringify everything else
+ return "$ref";
}
my %known_specs = (
my ($element, $key, $meta, $version) = @_;
return unless $element;
- # cleanup wrong format
+ # clean up wrong format
if ( ! ref $element ) {
my $item = $element;
$element = { directory => [ $item ], file => [ $item ] };
}
elsif ( ref $element eq 'ARRAY' ) {
my $hashref = { map { $_ => 0 } @$element };
- return _version_map($hashref); # cleanup any weird stuff
+ return _version_map($hashref); # clean up any weird stuff
}
elsif ( ref $element eq '' && length $element ) {
return { $element => 0 }
=head1 VERSION
-version 2.150005
+version 2.150010
=head1 SYNOPSIS
Ricardo Signes <rjbs@cpan.org>
+=item *
+
+Adam Kennedy <adamk@cpan.org>
+
=back
=head1 COPYRIGHT AND LICENSE
-This software is copyright (c) 2010 by David Golden and Ricardo Signes.
+This software is copyright (c) 2010 by David Golden, Ricardo Signes, Adam Kennedy and Contributors.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
use warnings;
package CPAN::Meta::Feature;
-our $VERSION = '2.150005';
+our $VERSION = '2.150010';
use CPAN::Meta::Prereqs;
=head1 VERSION
-version 2.150005
+version 2.150010
=head1 DESCRIPTION
Ricardo Signes <rjbs@cpan.org>
+=item *
+
+Adam Kennedy <adamk@cpan.org>
+
=back
=head1 COPYRIGHT AND LICENSE
-This software is copyright (c) 2010 by David Golden and Ricardo Signes.
+This software is copyright (c) 2010 by David Golden, Ricardo Signes, Adam Kennedy and Contributors.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
use warnings;
package CPAN::Meta::History;
-our $VERSION = '2.150005';
+our $VERSION = '2.150010';
1;
=head1 VERSION
-version 2.150005
+version 2.150010
=head1 DESCRIPTION
Ricardo Signes <rjbs@cpan.org>
+=item *
+
+Adam Kennedy <adamk@cpan.org>
+
=back
=head1 COPYRIGHT AND LICENSE
-This software is copyright (c) 2010 by David Golden and Ricardo Signes.
+This software is copyright (c) 2010 by David Golden, Ricardo Signes, Adam Kennedy and Contributors.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=item *
Include list of valid licenses from L<Module::Build> 0.17 rather than
-linking to the module.
+linking to the module, with minor updates to text and links to reflect
+versions at the time of publication.
+
+=item *
+
+Fixed some dead links to point to active resources.
=back
F<META.yml> files are written in the L<YAML|http://www.yaml.org/> format. The
reasons we chose YAML instead of, say, XML or Data::Dumper are discussed in
-L<this thread|http://archive.develooper.com/makemaker@perl.org/msg00405.html>
+L<this thread|http://www.nntp.perl.org/group/perl.makemaker/2002/04/msg406.html>
on the MakeMaker mailing list.
-The first line of a F<META.yml> file should be a valid L<YAML document header|http://www.yaml.org/spec/#.Document>
+The first line of a F<META.yml> file should be a valid
+L<YAML document header|http://yaml.org/spec/history/2002-10-31.html#syntax-document>
like C<"--- #YAML:1.0">
=head1 Fields
The rest of the META.yml file is one big YAML
-L<mapping|http://www.yaml.org/spec/#.-syntax-mapping-Mapping->,
+L<mapping|http://yaml.org/spec/history/2002-10-31.html#syntax-mapping>,
whose keys are described here.
=over 4
The distribution may be copied and redistributed under the same terms as perl
itself (this is by far the most common licensing option for modules on CPAN).
-This is a dual license, in which the user may choose between either the GPL or
-the Artistic license.
+This is a dual license, in which the user may choose between either the GPL
+version 1 or the Artistic version 1 license.
=item gpl
-The distribution is distributed under the terms of the Gnu General Public
-License (L<http://www.opensource.org/licenses/gpl-license.php>).
+The distribution is distributed under the terms of the GNU General Public
+License version 2 (L<http://opensource.org/licenses/GPL-2.0>).
=item lgpl
-The distribution is distributed under the terms of the Gnu Lesser General
-Public License (L<http://www.opensource.org/licenses/lgpl-license.php>).
+The distribution is distributed under the terms of the GNU Lesser General
+Public License version 2 (L<http://opensource.org/licenses/LGPL-2.1>).
=item artistic
-The distribution is licensed under the Artistic License, as specified by the
-Artistic file in the standard perl distribution.
+The distribution is licensed under the Artistic License version 1, as specified
+by the Artistic file in the standard perl distribution
+(L<http://opensource.org/licenses/Artistic-Perl-1.0>).
=item bsd
-The distribution is licensed under the BSD License
-(L<http://www.opensource.org/licenses/bsd-license.php>).
+The distribution is licensed under the BSD 3-Clause License
+(L<http://opensource.org/licenses/BSD-3-Clause>).
=item open_source
=item unrestricted
The distribution is licensed under a license that is B<not> approved by
-L<www.opensource.org|http://www.opensource.org> but that allows distribution
+L<www.opensource.org|http://www.opensource.org/> but that allows distribution
without restrictions.
=item restrictive
Data::Dumper: 0
File::Find: 1.03
-A YAML L<mapping|http://www.yaml.org/spec/#.-syntax-mapping-Mapping->
+A YAML L<mapping|http://yaml.org/spec/history/2002-10-31.html#syntax-mapping>
indicating the Perl modules this distribution requires for proper
operation. The keys are the module names, and the values are version
-specifications as described in the L<Module::Build|documentation for Module::Build's "requires" parameter>.
+specifications as described in the
+L<documentation for Module::Build's "requires" parameter|Module::Build::API/requires>.
I<Note: the exact nature of the fancy specifications like
C<< ">= 1.2, != 1.5, < 2.0" >> is subject to
Data::Dumper: 0
File::Find: 1.03
-A YAML L<mapping|http://www.yaml.org/spec/#.-syntax-mapping-Mapping->
+A YAML L<mapping|http://yaml.org/spec/history/2002-10-31.html#syntax-mapping>
indicating the Perl modules this distribution recommends for enhanced
operation.
Data::Dumper: 0
File::Find: 1.03
-A YAML L<mapping|http://www.yaml.org/spec/#.-syntax-mapping-Mapping->
+A YAML L<mapping|http://yaml.org/spec/history/2002-10-31.html#syntax-mapping>
indicating the Perl modules required for building and/or testing of
this distribution. These dependencies are not required after the
module is installed.
Data::Dumper: 0
File::Find: 1.03
-A YAML L<mapping|http://www.yaml.org/spec/#.-syntax-mapping-Mapping->
+A YAML L<mapping|http://yaml.org/spec/history/2002-10-31.html#syntax-mapping>
indicating the Perl modules that cannot be installed while this
distribution is installed. This is a pretty uncommon situation.
Currently L<Module::Build> doesn't actually do anything with
this flag - it's probably going to be up to higher-level tools like
-L<CPAN|CPAN.pm> to do something useful with it. It can potentially
+L<CPAN.pm|CPAN> to do something useful with it. It can potentially
bring lots of security, packaging, and convenience improvements.
=item generated_by
=item *
Include list of valid licenses from L<Module::Build> 0.18 rather than
-linking to the module.
+linking to the module, with minor updates to text and links to reflect
+versions at the time of publication.
+
+=item *
+
+Fixed some dead links to point to active resources.
=back
F<META.yml> files are written in the L<YAML|http://www.yaml.org/> format. The
reasons we chose YAML instead of, say, XML or Data::Dumper are discussed in
-L<this thread|http://archive.develooper.com/makemaker@perl.org/msg00405.html>
+L<this thread|http://www.nntp.perl.org/group/perl.makemaker/2002/04/msg406.html>
on the MakeMaker mailing list.
-The first line of a F<META.yml> file should be a valid L<YAML document header|http://www.yaml.org/spec/#.Document>
+The first line of a F<META.yml> file should be a valid
+L<YAML document header|http://yaml.org/spec/history/2002-10-31.html#syntax-document>
like C<"--- #YAML:1.0">
=head1 Fields
The rest of the META.yml file is one big YAML
-L<mapping|http://www.yaml.org/spec/#.-syntax-mapping-Mapping->,
+L<mapping|http://yaml.org/spec/history/2002-10-31.html#syntax-mapping>,
whose keys are described here.
=over 4
The distribution may be copied and redistributed under the same terms as perl
itself (this is by far the most common licensing option for modules on CPAN).
-This is a dual license, in which the user may choose between either the GPL or
-the Artistic license.
+This is a dual license, in which the user may choose between either the GPL
+version 1 or the Artistic version 1 license.
=item gpl
-The distribution is distributed under the terms of the Gnu General Public
-License (L<http://www.opensource.org/licenses/gpl-license.php>).
+The distribution is distributed under the terms of the GNU General Public
+License version 2 (L<http://opensource.org/licenses/GPL-2.0>).
=item lgpl
-The distribution is distributed under the terms of the Gnu Lesser General
-Public License (L<http://www.opensource.org/licenses/lgpl-license.php>).
+The distribution is distributed under the terms of the GNU Lesser General
+Public License version 2 (L<http://opensource.org/licenses/LGPL-2.1>).
=item artistic
-The distribution is licensed under the Artistic License, as specified by the
-Artistic file in the standard perl distribution.
+The distribution is licensed under the Artistic License version 1, as specified
+by the Artistic file in the standard perl distribution
+(L<http://opensource.org/licenses/Artistic-Perl-1.0>).
=item bsd
-The distribution is licensed under the BSD License
-(L<http://www.opensource.org/licenses/bsd-license.php>).
+The distribution is licensed under the BSD 3-Clause License
+(L<http://opensource.org/licenses/BSD-3-Clause>).
=item open_source
=item unrestricted
The distribution is licensed under a license that is B<not> approved by
-L<www.opensource.org|http://www.opensource.org> but that allows distribution
+L<www.opensource.org|http://www.opensource.org/> but that allows distribution
without restrictions.
=item restrictive
Data::Dumper: 0
File::Find: 1.03
-A YAML L<mapping|http://www.yaml.org/spec/#.-syntax-mapping-Mapping->
+A YAML L<mapping|http://yaml.org/spec/history/2002-10-31.html#syntax-mapping>
indicating the Perl modules this distribution requires for proper
operation. The keys are the module names, and the values are version
-specifications as described in the L<Module::Build|documentation for Module::Build's "requires" parameter>.
+specifications as described in the
+L<documentation for Module::Build's "requires" parameter|Module::Build::API/requires>.
I<Note: the exact nature of the fancy specifications like
C<< ">= 1.2, != 1.5, < 2.0" >> is subject to
Data::Dumper: 0
File::Find: 1.03
-A YAML L<mapping|http://www.yaml.org/spec/#.-syntax-mapping-Mapping->
+A YAML L<mapping|http://yaml.org/spec/history/2002-10-31.html#syntax-mapping>
indicating the Perl modules this distribution recommends for enhanced
operation.
Data::Dumper: 0
File::Find: 1.03
-A YAML L<mapping|http://www.yaml.org/spec/#.-syntax-mapping-Mapping->
+A YAML L<mapping|http://yaml.org/spec/history/2002-10-31.html#syntax-mapping>
indicating the Perl modules required for building and/or testing of
this distribution. These dependencies are not required after the
module is installed.
Data::Dumper: 0
File::Find: 1.03
-A YAML L<mapping|http://www.yaml.org/spec/#.-syntax-mapping-Mapping->
+A YAML L<mapping|http://yaml.org/spec/history/2002-10-31.html#syntax-mapping>
indicating the Perl modules that cannot be installed while this
distribution is installed. This is a pretty uncommon situation.
Currently L<Module::Build> doesn't actually do anything with
this flag - it's probably going to be up to higher-level tools like
-L<CPAN|CPAN.pm> to do something useful with it. It can potentially
+L<CPAN.pm|CPAN> to do something useful with it. It can potentially
bring lots of security, packaging, and convenience improvements.
=item generated_by
=item *
Include list of valid licenses from L<Module::Build> 0.2611 rather than
-linking to the module.
+linking to the module, with minor updates to text and links to reflect
+versions at the time of publication.
+
+=item *
+
+Fixed some dead links to point to active resources.
=back
=item *
-Module::Build design plans
-
-L<http://nntp.x.perl.org/group/perl.makemaker/406>
+L<Module::Build design plans|http://www.nntp.perl.org/group/perl.makemaker/2002/04/msg407.html>
=item *
-Not keen on YAML
-
-L<http://nntp.x.perl.org/group/perl.module-authors/1353>
+L<Not keen on YAML|http://www.nntp.perl.org/group/perl.module-authors/2003/11/msg1353.html>
=item *
-META Concerns
-
-L<http://nntp.x.perl.org/group/perl.module-authors/1385>
+L<META Concerns|http://www.nntp.perl.org/group/perl.module-authors/2003/11/msg1385.html>
=back
=head1 VERSION SPECIFICATIONS
-Some fields require a version specification (ex. L<"requires">,
-L<"recommends">, L<"build_requires">, etc.). This section details the
+Some fields require a version specification (ex. L</requires>,
+L</recommends>, L</build_requires>, etc.). This section details the
version specifications that are currently supported.
If a single version is listed, then that version is considered to be
The distribution may be copied and redistributed under the same terms as perl
itself (this is by far the most common licensing option for modules on CPAN).
-This is a dual license, in which the user may choose between either the GPL or
-the Artistic license.
+This is a dual license, in which the user may choose between either the GPL
+version 1 or the Artistic version 1 license.
=item gpl
-The distribution is distributed under the terms of the Gnu General Public
-License (L<http://www.opensource.org/licenses/gpl-license.php>).
+The distribution is distributed under the terms of the GNU General Public
+License version 2 (L<http://opensource.org/licenses/GPL-2.0>).
=item lgpl
-The distribution is distributed under the terms of the Gnu Lesser General
-Public License (L<http://www.opensource.org/licenses/lgpl-license.php>).
+The distribution is distributed under the terms of the GNU Lesser General
+Public License version 2 (L<http://opensource.org/licenses/LGPL-2.1>).
=item artistic
-The distribution is licensed under the Artistic License, as specified by the
-Artistic file in the standard perl distribution.
+The distribution is licensed under the Artistic License version 1, as specified
+by the Artistic file in the standard perl distribution
+(L<http://opensource.org/licenses/Artistic-Perl-1.0>).
=item bsd
-The distribution is licensed under the BSD License
-(L<http://www.opensource.org/licenses/bsd-license.php>).
+The distribution is licensed under the BSD 3-Clause License
+(L<http://opensource.org/licenses/BSD-3-Clause>).
=item open_source
=item unrestricted
The distribution is licensed under a license that is B<not> approved by
-L<www.opensource.org|http://www.opensource.org> but that allows distribution
+L<www.opensource.org|http://www.opensource.org/> but that allows distribution
without restrictions.
=item restrictive
I<(Spec 1.1) [optional] {map} A YAML sequence of names for optional features
which are made available when its requirements are met. For each
-feature a description is provided along with any of L<"requires">,
-L<"build_requires">, L<"conflicts">, L<"requires_packages">,
-L<"requires_os">, and L<"excludes_os"> which have the same meaning in
+feature a description is provided along with any of L</requires>,
+L</build_requires>, L</conflicts>, C<requires_packages>,
+C<requires_os>, and C<excludes_os> which have the same meaning in
this subcontext as described elsewhere in this document.>
=head2 build_requires
=head2 private
I<(Deprecated)> (Spec 1.0) [optional] {map} This field has been renamed to
-L</"no_index">. See below.
+L</no_index>. See below.
=head2 provides
CPAN, and search.cpan.org to build indexes saying in which
distribution various packages can be found.
-When using tools like C<Module::Build> that can generate the
+When using tools like L<Module::Build> that can generate the
C<provides> mapping for your distribution automatically, make sure you
examine what it generates to make sure it makes sense - indexers will
usually trust the C<provides> field if it's present, rather than
=head1 SEE ALSO
-CPAN, L<http://www.cpan.org/>
+L<CPAN|http://www.cpan.org/>
-CPAN.pm, L<http://search.cpan.org/author/ANDK/CPAN/>
+L<CPAN.pm|CPAN>
-CPANPLUS, L<http://search.cpan.org/author/KANE/CPANPLUS/>
+L<CPANPLUS>
-Data::Dumper, L<http://search.cpan.org/author/ILYAM/Data-Dumper/>
+L<Data::Dumper>
-ExtUtils::MakeMaker, L<http://search.cpan.org/author/MSCHWERN/ExtUtils-MakeMaker/>
+L<ExtUtils::MakeMaker>
-Module::Build, L<http://search.cpan.org/author/KWILLIAMS/Module-Build/>
+L<Module::Build>
-Module::Install, L<http://search.cpan.org/author/KWILLIAMS/Module-Install/>
+L<Module::Install>
-XML, L<http://www.w3.org/XML/>
+L<XML|http://www.w3.org/XML/>
-YAML, L<http://www.yaml.org/>
+L<YAML|http://www.yaml.org/>
=head1 HISTORY
=item *
-Added the L</"dynamic_config"> field, which was missing from the initial
+Added the L</dynamic_config> field, which was missing from the initial
version.
=back
=item *
-Added and deprecated the L<"private"> field.
+Added and deprecated the L</private> field.
=item *
-Added L<"abstract">, L<"configure">, L<"requires_packages">,
-L<"requires_os">, L<"excludes_os">, and L<"no_index"> fields.
+Added L</abstract>, C<configure>, C<requires_packages>,
+C<requires_os>, C<excludes_os>, and L</no_index> fields.
=item *
=item *
-Added L<"generation">, L<"authored_by"> fields.
+Added C<generation>, C<authored_by> fields.
=item *
-Add alternative proposal to the L<"recommends"> field.
+Add alternative proposal to the L</recommends> field.
=item *
-Add proposal for a L<"requires_build_tools"> field.
+Add proposal for a C<requires_build_tools> field.
=back
=item *
-Added section L<"VERSION SPECIFICATIONS">.
+Added section L</"VERSION SPECIFICATIONS">.
=item *
=item *
-Add proposal for L<"auto_regenerate"> field.
+Add proposal for C<auto_regenerate> field.
=back
=item *
-Add L<"index"> field as a compliment to L<"no_index">
+Add C<index> field as a compliment to L</no_index>
=item *
-Add L<"keywords"> field as a means to aid searching distributions.
+Add L</keywords> field as a means to aid searching distributions.
=item *
-Add L<"TERMINOLOGY"> section to explain certain terms that may be
+Add L</TERMINOLOGY> section to explain certain terms that may be
ambiguous.
=back
=item *
-Changed C<authored_by> to C<author>, since that's always been what
+Changed C<authored_by> to L</author>, since that's always been what
it's actually called in actual F<META.yml> files.
=item *
=item *
-Noted that the C<distribution_type> field is basically meaningless,
+Noted that the L</distribution_type> field is basically meaningless,
and shouldn't really be used.
=item *
-Clarified C<dynamic_config> a bit.
+Clarified L</dynamic_config> a bit.
=back
=item *
Include list of valid licenses from L<Module::Build> 0.2805 rather than
-linking to the module.
+linking to the module, with minor updates to text and links to reflect
+versions at the time of publication.
+
+=item *
+
+Fixed some dead links to point to active resources.
=back
=over 4
-=item Module::Build design plans
+=item *
-L<http://nntp.x.perl.org/group/perl.makemaker/406>
+L<Module::Build design plans|http://www.nntp.perl.org/group/perl.makemaker/2002/04/msg407.html>
-=item Not keen on YAML
+=item *
-L<http://nntp.x.perl.org/group/perl.module-authors/1353>
+L<Not keen on YAML|http://www.nntp.perl.org/group/perl.module-authors/2003/11/msg1353.html>
-=item META Concerns
+=item *
-L<http://nntp.x.perl.org/group/perl.module-authors/1385>
+L<META Concerns|http://www.nntp.perl.org/group/perl.module-authors/2003/11/msg1385.html>
=back
=item apache
-The distribution is licensed under the Apache Software License
-(L<http://opensource.org/licenses/apachepl.php>).
+The distribution is licensed under the Apache Software License version 1.1
+(L<http://opensource.org/licenses/Apache-1.1>).
=item artistic
-The distribution is licensed under the Artistic License, as specified by the
-Artistic file in the standard perl distribution.
+The distribution is licensed under the Artistic License version 1, as specified
+by the Artistic file in the standard perl distribution
+(L<http://opensource.org/licenses/Artistic-Perl-1.0>).
=item bsd
-The distribution is licensed under the BSD License
-(L<http://www.opensource.org/licenses/bsd-license.php>).
+The distribution is licensed under the BSD 3-Clause License
+(L<http://opensource.org/licenses/BSD-3-Clause>).
=item gpl
-The distribution is licensed under the terms of the Gnu General Public License
-(L<http://www.opensource.org/licenses/gpl-license.php>).
+The distribution is distributed under the terms of the GNU General Public
+License version 2 (L<http://opensource.org/licenses/GPL-2.0>).
=item lgpl
-The distribution is licensed under the terms of the Gnu Lesser General Public
-License (L<http://www.opensource.org/licenses/lgpl-license.php>).
+The distribution is distributed under the terms of the GNU Lesser General
+Public License version 2 (L<http://opensource.org/licenses/LGPL-2.1>).
=item mit
The distribution is licensed under the MIT License
-(L<http://opensource.org/licenses/mit-license.php>).
+(L<http://opensource.org/licenses/MIT>).
=item mozilla
The distribution is licensed under the Mozilla Public License.
-(L<http://opensource.org/licenses/mozilla1.0.php> or
-L<http://opensource.org/licenses/mozilla1.1.php>)
+(L<http://opensource.org/licenses/MPL-1.0> or
+L<http://opensource.org/licenses/MPL-1.1>)
=item open_source
The distribution may be copied and redistributed under the same terms as perl
itself (this is by far the most common licensing option for modules on CPAN).
-This is a dual license, in which the user may choose between either the GPL or
-the Artistic license.
+This is a dual license, in which the user may choose between either the GPL
+version 1 or the Artistic version 1 license.
=item restrictive
(Spec 1.0) [optional] {map} A YAML mapping indicating the Perl modules this
distribution requires for proper operation. The keys are the module
names, and the values are version specifications as described in
-L<VERSION SPECIFICATIONS>.
+L</"VERSION SPECIFICATIONS">.
=head2 recommends
(Spec 1.0) [optional] {map} A YAML mapping indicating the Perl modules
this distribution recommends for enhanced operation. The keys are the
module names, and the values are version specifications as described
-in L<VERSION SPECIFICATIONS>.
+in L</"VERSION SPECIFICATIONS">.
I<(Spec 1.1) [optional] {map} A YAML sequence of names for optional features
which are made available when its requirements are met. For each
-feature a description is provided along with any of L<"requires">,
-L<"build_requires">, L<"conflicts">, L<"requires_packages">,
-L<"requires_os">, and L<"excludes_os"> which have the same meaning in
+feature a description is provided along with any of L</requires>,
+L</build_requires>, L</conflicts>, C<requires_packages>,
+C<requires_os>, and C<excludes_os> which have the same meaning in
this subcontext as described elsewhere in this document.>
=head2 build_requires
(Spec 1.0) [optional] {map} A YAML mapping indicating the Perl modules
required for building and/or testing of this distribution. The keys
are the module names, and the values are version specifications as
-described in L<VERSION SPECIFICATIONS>. These dependencies are not
+described in L</"VERSION SPECIFICATIONS">. These dependencies are not
required after the module is installed.
=head2 conflicts
cannot be installed while this distribution is installed. This is a
pretty uncommon situation. The keys for C<conflicts> are the module
names, and the values are version specifications as described in
-L<VERSION SPECIFICATIONS>.
+L</"VERSION SPECIFICATIONS">.
=head2 dynamic_config
=head2 private
I<(Deprecated)> (Spec 1.0) [optional] {map} This field has been renamed to
-L</"no_index">. See below.
+L</no_index>. See below.
=head2 provides
CPAN, and search.cpan.org to build indexes saying in which
distribution various packages can be found.
-When using tools like C<Module::Build> that can generate the
+When using tools like L<Module::Build> that can generate the
C<provides> mapping for your distribution automatically, make sure you
examine what it generates to make sure it makes sense - indexers will
usually trust the C<provides> field if it's present, rather than
and indexing tools. This is useful when no C<provides> field is
present.
-For example, C<search.cpan.org> excludes items listed in C<no_index>
+For example, L<http://search.cpan.org/> excludes items listed in C<no_index>
when searching for POD, meaning files in these directories will not
converted to HTML and made public - which is useful if you have
example or test PODs that you don't want the search engine to go
=head1 VERSION SPECIFICATIONS
-Some fields require a version specification (ex. L<"requires">,
-L<"recommends">, L<"build_requires">, etc.) to indicate the particular
+Some fields require a version specification (ex. L</requires>,
+L</recommends>, L</build_requires>, etc.) to indicate the particular
versionZ<>(s) of some other module that may be required as a
prerequisite. This section details the version specification formats
that are currently supported.
=head1 SEE ALSO
-CPAN, L<http://www.cpan.org/>
+L<CPAN|http://www.cpan.org/>
-CPAN.pm, L<http://search.cpan.org/dist/CPAN/>
+L<CPAN.pm|CPAN>
-CPANPLUS, L<http://search.cpan.org/dist/CPANPLUS/>
+L<CPANPLUS>
-Data::Dumper, L<http://search.cpan.org/dist/Data-Dumper/>
+L<Data::Dumper>
-ExtUtils::MakeMaker, L<http://search.cpan.org/dist/ExtUtils-MakeMaker/>
+L<ExtUtils::MakeMaker>
-Module::Build, L<http://search.cpan.org/dist/Module-Build/>
+L<Module::Build>
-Module::Install, L<http://search.cpan.org/dist/Module-Install/>
+L<Module::Install>
-XML, L<http://www.w3.org/XML/>
+L<XML|http://www.w3.org/XML/>
-YAML, L<http://www.yaml.org/>
+L<YAML|http://www.yaml.org/>
=head1 HISTORY
=item *
-Added the L</"dynamic_config"> field, which was missing from the initial
+Added the L</dynamic_config> field, which was missing from the initial
version.
=back
=item *
-Added and deprecated the L<"private"> field.
+Added and deprecated the L</private> field.
=item *
-Added L<"abstract">, L<"configure">, L<"requires_packages">,
-L<"requires_os">, L<"excludes_os">, and L<"no_index"> fields.
+Added L</abstract>, C<configure>, C<requires_packages>,
+C<requires_os>, C<excludes_os>, and L</no_index> fields.
=item *
=item *
-Added L<"generation">, L<"authored_by"> fields.
+Added C<generation>, C<authored_by> fields.
=item *
-Add alternative proposal to the L<"recommends"> field.
+Add alternative proposal to the L</recommends> field.
=item *
-Add proposal for a L<"requires_build_tools"> field.
+Add proposal for a C<requires_build_tools> field.
=back
=item *
-Added section L<"VERSION SPECIFICATIONS">.
+Added section L</"VERSION SPECIFICATIONS">.
=item *
=item *
-Add proposal for L<"auto_regenerate"> field.
+Add proposal for C<auto_regenerate> field.
=back
=item *
-Add L<"index"> field as a compliment to L<"no_index">
+Add C<index> field as a compliment to L</no_index>
=item *
-Add L<"keywords"> field as a means to aid searching distributions.
+Add L</keywords> field as a means to aid searching distributions.
=item *
-Add L<"TERMINOLOGY"> section to explain certain terms that may be
+Add L</TERMINOLOGY> section to explain certain terms that may be
ambiguous.
=back
=item *
-Changed C<authored_by> to C<author>, since that's always been what
+Changed C<authored_by> to L</author>, since that's always been what
it's actually called in actual F<META.yml> files.
=item *
=item *
-Noted that the C<distribution_type> field is basically meaningless,
+Noted that the L</distribution_type> field is basically meaningless,
and shouldn't really be used.
=item *
-Clarified C<dynamic_config> a bit.
+Clarified L</dynamic_config> a bit.
=back
=item *
Include list of valid licenses from L<Module::Build> 0.2807 rather than
-linking to the module.
+linking to the module, with minor updates to text and links to reflect
+versions at the time of publication.
+
+=item *
+
+Fixed some dead links to point to active resources.
=back
won't make it into the stable version) can always be found at
L<http://module-build.sourceforge.net/META-spec-blead.html>.>
-=begin MAINTAINER
-
-The master source for the META spec is META-spec.pod. META-spec.html
-is built (manually) from META-spec.pod whenever there are changes, and
-the two files should generally be checked in together. Ideally it
-would happen through a trigger or something, but it doesn't.
-
-Ken has a cron job that copies the latest bleeding-edge version of the
-spec (HTML version) to Sourceforge whenever his laptop is turned on:
-
- 21 * * * * svn cat http://svn.perl.org/modules/Module-Build/trunk/website/META-spec.html \
- | ssh kwilliams@shell.sourceforge.net \
- 'cat > /home/groups/m/mo/module-build/htdocs/META-spec-blead.html'
-
-The numbered revisions of the spec at
-L<"http://module-build.sourceforge.net/"> are captures of the spec at
-opportune moments. A couple of symlinks also exist for convenience:
-
- -rw-r--r-- 1 kwilliams 24585 Oct 10 17:21 META-spec-blead.html
- lrwxrwxrwx 1 kwilliams 19 Jan 19 2007 META-spec-current.html -> META-spec-v1.3.html
- lrwxrwxrwx 1 kwilliams 22 Jan 19 2007 META-spec.html -> META-spec-current.html
- -rw-r--r-- 1 kwilliams 5830 Jul 25 2005 META-spec-v1.0.html
- -rw-r--r-- 1 kwilliams 7847 Jul 25 2005 META-spec-v1.1.html
- -rw-r--r-- 1 kwilliams 22635 Aug 23 2005 META-spec-v1.2.html
- -rw-r--r-- 1 kwilliams 24086 Nov 4 2006 META-spec-v1.3.html
-
-=end MAINTAINER
-
-
=head1 FORMAT
F<META.yml> files are written in the YAML format (see
=over 4
-=item Module::Build design plans
+=item *
-L<http://nntp.x.perl.org/group/perl.makemaker/406>
+L<Module::Build design plans|http://www.nntp.perl.org/group/perl.makemaker/2002/04/msg407.html>
-=item Not keen on YAML
+=item *
-L<http://nntp.x.perl.org/group/perl.module-authors/1353>
+L<Not keen on YAML|http://www.nntp.perl.org/group/perl.module-authors/2003/11/msg1353.html>
-=item META Concerns
+=item *
-L<http://nntp.x.perl.org/group/perl.module-authors/1385>
+L<META Concerns|http://www.nntp.perl.org/group/perl.module-authors/2003/11/msg1385.html>
=back
=item apache
-The distribution is licensed under the Apache Software License
-(L<http://opensource.org/licenses/apachepl.php>).
+The distribution is licensed under the Apache Software License version 1.1
+(L<http://opensource.org/licenses/Apache-1.1>).
=item artistic
-The distribution is licensed under the Artistic License, as specified by the
-Artistic file in the standard perl distribution.
+The distribution is licensed under the Artistic License version 1, as specified
+by the Artistic file in the standard perl distribution
+(L<http://opensource.org/licenses/Artistic-Perl-1.0>).
=item bsd
-The distribution is licensed under the BSD License
-(L<http://www.opensource.org/licenses/bsd-license.php>).
+The distribution is licensed under the BSD 3-Clause License
+(L<http://opensource.org/licenses/BSD-3-Clause>).
=item gpl
-The distribution is licensed under the terms of the Gnu General Public License
-(L<http://www.opensource.org/licenses/gpl-license.php>).
+The distribution is distributed under the terms of the GNU General Public
+License version 2 (L<http://opensource.org/licenses/GPL-2.0>).
=item lgpl
-The distribution is licensed under the terms of the Gnu Lesser General Public
-License (L<http://www.opensource.org/licenses/lgpl-license.php>).
+The distribution is distributed under the terms of the GNU Lesser General
+Public License version 2 (L<http://opensource.org/licenses/LGPL-2.1>).
=item mit
The distribution is licensed under the MIT License
-(L<http://opensource.org/licenses/mit-license.php>).
+(L<http://opensource.org/licenses/MIT>).
=item mozilla
The distribution is licensed under the Mozilla Public License.
-(L<http://opensource.org/licenses/mozilla1.0.php> or
-L<http://opensource.org/licenses/mozilla1.1.php>)
+(L<http://opensource.org/licenses/MPL-1.0> or
+L<http://opensource.org/licenses/MPL-1.1>)
=item open_source
I<(Spec 1.1) [optional] {map} A YAML mapping of names for optional features
which are made available when its requirements are met. For each
-feature a description is provided along with any of L<"requires">,
-L<"build_requires">, and L<"conflicts">, which have the same meaning in
+feature a description is provided along with any of L</requires>,
+L</build_requires>, and L</conflicts>, which have the same meaning in
this subcontext as described elsewhere in this document.>
=head2 build_requires
prerequisites required for building and/or testing of this
distribution. The keys are the names of the prerequisites (module
names or 'perl'), and the values are version specifications as
-described in L<VERSION SPECIFICATIONS>. These dependencies are not
+described in L</"VERSION SPECIFICATIONS">. These dependencies are not
required after the distribution is installed.
=head2 configure_requires
(Spec 1.4) [optional] {map} A YAML mapping indicating the Perl prerequisites
required before configuring this distribution. The keys are the
-names of the prerequisites (module names or 'perl'), and the values are version specifications as described
-in L<VERSION SPECIFICATIONS>. These dependencies are not required
-after the distribution is installed.
+names of the prerequisites (module names or 'perl'), and the values are version
+specifications as described in L</"VERSION SPECIFICATIONS">. These
+dependencies are not required after the distribution is installed.
=head2 conflicts
cannot be installed while this distribution is installed. This is a
pretty uncommon situation. The keys for C<conflicts> are the item
names (module names or 'perl'), and the values are version
-specifications as described in L<VERSION SPECIFICATIONS>.
+specifications as described in L</"VERSION SPECIFICATIONS">.
=head2 dynamic_config
=head2 private
I<(Deprecated)> (Spec 1.0) [optional] {map} This field has been renamed to
-L</"no_index">. See below.
+L</no_index>. See below.
=head2 provides
CPAN, and search.cpan.org to build indexes saying in which
distribution various packages can be found.
-When using tools like C<Module::Build> that can generate the
+When using tools like L<Module::Build> that can generate the
C<provides> mapping for your distribution automatically, make sure you
examine what it generates to make sure it makes sense - indexers will
usually trust the C<provides> field if it's present, rather than
and indexing tools. This is useful when no C<provides> field is
present.
-For example, C<search.cpan.org> excludes items listed in C<no_index>
+For example, L<http://search.cpan.org/> excludes items listed in C<no_index>
when searching for POD, meaning files in these directories will not
converted to HTML and made public - which is useful if you have
example or test PODs that you don't want the search engine to go
=head1 VERSION SPECIFICATIONS
-Some fields require a version specification (ex. L<"requires">,
-L<"recommends">, L<"build_requires">, etc.) to indicate the particular
+Some fields require a version specification (ex. L</requires>,
+L</recommends>, L</build_requires>, etc.) to indicate the particular
versionZ<>(s) of some other module that may be required as a
prerequisite. This section details the version specification formats
that are currently supported.
=head1 SEE ALSO
-CPAN, L<http://www.cpan.org/>
+L<CPAN|http://www.cpan.org/>
-CPAN.pm, L<http://search.cpan.org/dist/CPAN/>
+L<CPAN.pm|CPAN>
-CPANPLUS, L<http://search.cpan.org/dist/CPANPLUS/>
+L<CPANPLUS>
-Data::Dumper, L<http://search.cpan.org/dist/Data-Dumper/>
+L<Data::Dumper>
-ExtUtils::MakeMaker, L<http://search.cpan.org/dist/ExtUtils-MakeMaker/>
+L<ExtUtils::MakeMaker>
-Module::Build, L<http://search.cpan.org/dist/Module-Build/>
+L<Module::Build>
-Module::Install, L<http://search.cpan.org/dist/Module-Install/>
+L<Module::Install>
-XML, L<http://www.w3.org/XML/>
+L<XML|http://www.w3.org/XML/>
-YAML, L<http://www.yaml.org/>
+L<YAML|http://www.yaml.org/>
=head1 HISTORY
=item *
-Added the L</"dynamic_config"> field, which was missing from the initial
+Added the L</dynamic_config> field, which was missing from the initial
version.
=back
=item *
-Added and deprecated the L<"private"> field.
+Added and deprecated the L</private> field.
=item *
-Added L<"abstract">, L<"configure">, L<"requires_packages">,
-L<"requires_os">, L<"excludes_os">, and L<"no_index"> fields.
+Added L</abstract>, C<configure>, C<requires_packages>,
+C<requires_os>, C<excludes_os>, and L</no_index> fields.
=item *
=item *
-Added L<"generation">, L<"authored_by"> fields.
+Added C<generation>, C<authored_by> fields.
=item *
-Add alternative proposal to the L<"recommends"> field.
+Add alternative proposal to the L</recommends> field.
=item *
-Add proposal for a L<"requires_build_tools"> field.
+Add proposal for a C<requires_build_tools> field.
=back
=item *
-Added section L<"VERSION SPECIFICATIONS">.
+Added section L</"VERSION SPECIFICATIONS">.
=item *
=item *
-Add proposal for L<"auto_regenerate"> field.
+Add proposal for C<auto_regenerate> field.
=back
=item *
-Add L<"index"> field as a compliment to L<"no_index">
+Add C<index> field as a compliment to L</no_index>
=item *
-Add L<"keywords"> field as a means to aid searching distributions.
+Add L</keywords> field as a means to aid searching distributions.
=item *
-Add L<"TERMINOLOGY"> section to explain certain terms that may be
+Add L</TERMINOLOGY> section to explain certain terms that may be
ambiguous.
=back
=item *
-Changed C<authored_by> to C<author>, since that's always been what
+Changed C<authored_by> to L</author>, since that's always been what
it's actually called in actual F<META.yml> files.
=item *
=item *
-Noted that the C<distribution_type> field is basically meaningless,
+Noted that the L</distribution_type> field is basically meaningless,
and shouldn't really be used.
=item *
-Clarified C<dynamic_config> a bit.
+Clarified L</dynamic_config> a bit.
=back
=item *
-Added C<configure_requires>.
+Added L</configure_requires>.
=back
package CPAN::Meta::Merge;
-our $VERSION = '2.150005';
+our $VERSION = '2.150010';
use Carp qw/croak/;
use Scalar::Util qw/blessed/;
return $left;
}
-sub _improvize {
+sub _improvise {
my ($left, $right, $path) = @_;
my ($name) = reverse @{$path};
if ($name =~ /^x_/) {
homepage => \&_identical,
bugtracker => \&_uniq_map,
repository => \&_uniq_map,
- ':default' => \&_improvize,
+ ':default' => \&_improvise,
},
- ':default' => \&_improvize,
+ ':default' => \&_improvise,
);
sub new {
set_addition => \&_set_addition,
uniq_map => \&_uniq_map,
identical => \&_identical,
- improvize => \&_improvize,
+ improvise => \&_improvise,
+ improvize => \&_improvise, # [sic] for backwards compatibility
);
sub _coerce_mapping {
=head1 VERSION
-version 2.150005
+version 2.150010
=head1 SYNOPSIS
used for the merge. It can optionally take an C<extra_mappings> argument
that allows one to add additional merging functions for specific elements.
+The C<extra_mappings> arguments takes a hash ref with the same type of
+structure as described in L<CPAN::Meta::Spec>, except with its values as
+one of the L<defined merge strategies|/"MERGE STRATEGIES"> or a code ref
+to a merging function.
+
+ my $merger = CPAN::Meta::Merge->new(
+ default_version => '2',
+ extra_mappings => {
+ 'optional_features' => \&custom_merge_function,
+ 'x_custom' => 'set_addition',
+ 'x_meta_meta' => {
+ name => 'identical',
+ tags => 'set_addition',
+ }
+ }
+ );
+
=head2 merge(@fragments)
Merge all C<@fragments> together. It will accept both CPAN::Meta objects and
(possibly incomplete) hashrefs of metadata.
+=head1 MERGE STRATEGIES
+
+C<merge> uses various strategies to combine different elements of the CPAN::Meta objects. The following strategies can be used with the extra_mappings argument of C<new>:
+
+=over
+
+=item identical
+
+The elements must be identical
+
+=item set_addition
+
+The union of two array refs
+
+ [ a, b ] U [ a, c] = [ a, b, c ]
+
+=item uniq_map
+
+Key value pairs from the right hash are merged to the left hash. Key
+collisions are only allowed if their values are the same. This merge
+function will recurse into nested hash refs following the same merge
+rules.
+
+=item improvise
+
+This merge strategy will try to pick the appropriate predefined strategy
+based on what element type. Array refs will try to use the
+C<set_addition> strategy, Hash refs will try to use the C<uniq_map>
+strategy, and everything else will try the C<identical> strategy.
+
+=back
+
=head1 AUTHORS
=over 4
Ricardo Signes <rjbs@cpan.org>
+=item *
+
+Adam Kennedy <adamk@cpan.org>
+
=back
=head1 COPYRIGHT AND LICENSE
-This software is copyright (c) 2010 by David Golden and Ricardo Signes.
+This software is copyright (c) 2010 by David Golden, Ricardo Signes, Adam Kennedy and Contributors.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
use warnings;
package CPAN::Meta::Prereqs;
-our $VERSION = '2.150005';
+our $VERSION = '2.150010';
#pod =head1 DESCRIPTION
#pod
#pod
#pod =cut
+# note we also accept anything matching /\Ax_/i
sub __legal_phases { qw(configure build test runtime develop) }
sub __legal_types { qw(requires recommends suggests conflicts) }
return $req;
}
+#pod =method phases
+#pod
+#pod my @phases = $prereqs->phases;
+#pod
+#pod This method returns the list of all phases currently populated in the prereqs
+#pod object, suitable for iterating.
+#pod
+#pod =cut
+
+sub phases {
+ my ($self) = @_;
+
+ my %is_legal_phase = map {; $_ => 1 } $self->__legal_phases;
+ grep { /\Ax_/i or $is_legal_phase{$_} } keys %{ $self->{prereqs} };
+}
+
+#pod =method types_in
+#pod
+#pod my @runtime_types = $prereqs->types_in('runtime');
+#pod
+#pod This method returns the list of all types currently populated in the prereqs
+#pod object for the provided phase, suitable for iterating.
+#pod
+#pod =cut
+
+sub types_in {
+ my ($self, $phase) = @_;
+
+ return unless $phase =~ /\Ax_/i or grep { $phase eq $_ } $self->__legal_phases;
+
+ my %is_legal_type = map {; $_ => 1 } $self->__legal_types;
+ grep { /\Ax_/i or $is_legal_type{$_} } keys %{ $self->{prereqs}{$phase} };
+}
+
#pod =method with_merged_prereqs
#pod
#pod my $new_prereqs = $prereqs->with_merged_prereqs( $other_prereqs );
my %new_arg;
- for my $phase ($self->__legal_phases) {
- for my $type ($self->__legal_types) {
+ for my $phase (__uniq(map { $_->phases } @prereq_objs)) {
+ for my $type (__uniq(map { $_->types_in($phase) } @prereq_objs)) {
+
my $req = CPAN::Meta::Requirements->new;
for my $prereq (@prereq_objs) {
my %hash;
- for my $phase ($self->__legal_phases) {
- for my $type ($self->__legal_types) {
+ for my $phase ($self->phases) {
+ for my $type ($self->types_in($phase)) {
my $req = $self->requirements_for($phase, $type);
next unless $req->required_modules;
my $clone = (ref $self)->new( $self->as_string_hash );
}
+sub __uniq {
+ my (%s, $u);
+ grep { defined($_) ? !$s{$_}++ : !$u++ } @_;
+}
+
1;
# ABSTRACT: a set of distribution prerequisites by phase and type
=head1 VERSION
-version 2.150005
+version 2.150010
=head1 DESCRIPTION
If C<$phase> or C<$type> are undefined or otherwise invalid, an exception will
be raised.
+=head2 phases
+
+ my @phases = $prereqs->phases;
+
+This method returns the list of all phases currently populated in the prereqs
+object, suitable for iterating.
+
+=head2 types_in
+
+ my @runtime_types = $prereqs->types_in('runtime');
+
+This method returns the list of all types currently populated in the prereqs
+object for the provided phase, suitable for iterating.
+
=head2 with_merged_prereqs
my $new_prereqs = $prereqs->with_merged_prereqs( $other_prereqs );
Ricardo Signes <rjbs@cpan.org>
+=item *
+
+Adam Kennedy <adamk@cpan.org>
+
=back
=head1 COPYRIGHT AND LICENSE
-This software is copyright (c) 2010 by David Golden and Ricardo Signes.
+This software is copyright (c) 2010 by David Golden, Ricardo Signes, Adam Kennedy and Contributors.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
use warnings;
package CPAN::Meta::Spec;
-our $VERSION = '2.150005';
+our $VERSION = '2.150010';
1;
=head1 VERSION
-version 2.150005
+version 2.150010
=head1 SYNOPSIS
=head2 Boolean
A I<Boolean> is used to provide a true or false value. It B<must> be
-represented as a defined value.
+represented as a defined value that is either "1" or "0" or stringifies
+to those values.
=head2 String
L<Module::Install>
+=item *
+
+L<CPAN::Meta::History::Meta_1_4>
+
=back
=head1 HISTORY
Ricardo Signes <rjbs@cpan.org>
+=item *
+
+Adam Kennedy <adamk@cpan.org>
+
=back
=head1 COPYRIGHT AND LICENSE
-This software is copyright (c) 2010 by David Golden and Ricardo Signes.
+This software is copyright (c) 2010 by David Golden, Ricardo Signes, Adam Kennedy and Contributors.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
use warnings;
package CPAN::Meta::Validator;
-our $VERSION = '2.150005';
+our $VERSION = '2.150010';
#pod =head1 SYNOPSIS
#pod
#pod
#pod boolean($self,$key,$value)
#pod
-#pod Validates for a boolean value. Currently these values are '1', '0', 'true',
-#pod 'false', however the latter 2 may be removed.
+#pod Validates for a boolean value: a defined value that is either "1" or "0" or
+#pod stringifies to those values.
#pod
#pod =item *
#pod
sub boolean {
my ($self,$key,$value) = @_;
if(defined $value) {
- return 1 if($value =~ /^(0|1|true|false)$/);
+ return 1 if($value =~ /^(0|1)$/);
} else {
$value = '<undef>';
}
=head1 VERSION
-version 2.150005
+version 2.150010
=head1 SYNOPSIS
boolean($self,$key,$value)
-Validates for a boolean value. Currently these values are '1', '0', 'true',
-'false', however the latter 2 may be removed.
+Validates for a boolean value: a defined value that is either "1" or "0" or
+stringifies to those values.
=item *
Ricardo Signes <rjbs@cpan.org>
+=item *
+
+Adam Kennedy <adamk@cpan.org>
+
=back
=head1 COPYRIGHT AND LICENSE
-This software is copyright (c) 2010 by David Golden and Ricardo Signes.
+This software is copyright (c) 2010 by David Golden, Ricardo Signes, Adam Kennedy and Contributors.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
use 5.008001;
use strict;
+use warnings;
package Parse::CPAN::Meta;
# ABSTRACT: Parse META.yml and META.json CPAN metadata files
-our $VERSION = '1.4422';
+our $VERSION = '2.150010';
use Exporter;
use Carp 'croak';
}
sub yaml_backend {
- if (! defined $ENV{PERL_YAML_BACKEND} ) {
+ if ($ENV{PERL_CORE} or not defined $ENV{PERL_YAML_BACKEND} ) {
_can_load( 'CPAN::Meta::YAML', 0.011 )
or croak "CPAN::Meta::YAML 0.011 is not available\n";
return "CPAN::Meta::YAML";
}
sub json_decoder {
+ if ($ENV{PERL_CORE}) {
+ _can_load( 'JSON::PP' => 2.27300 )
+ or croak "JSON::PP 2.27300 is not available\n";
+ return 'JSON::PP';
+ }
if (my $decoder = $ENV{CPAN_META_JSON_DECODER}) {
_can_load( $decoder )
or croak "Could not load CPAN_META_JSON_DECODER '$decoder'\n";
}
sub json_backend {
+ if ($ENV{PERL_CORE}) {
+ _can_load( 'JSON::PP' => 2.27300 )
+ or croak "JSON::PP 2.27300 is not available\n";
+ return 'JSON::PP';
+ }
if (my $backend = $ENV{CPAN_META_JSON_BACKEND}) {
_can_load( $backend )
or croak "Could not load CPAN_META_JSON_BACKEND '$backend'\n";
$content = Encode::decode('UTF-8', $content, Encode::PERLQQ());
return $content;
}
-
+
sub _can_load {
my ($module, $version) = @_;
(my $file = $module) =~ s{::}{/}g;
=head1 VERSION
-version 1.4422
+version 2.150010
=head1 SYNOPSIS
#############################################
# In your file
-
+
---
name: My-Distribution
version: 1.23
resources:
homepage: "http://example.com/dist/My-Distribution"
-
-
+
+
#############################################
# In your program
-
+
use Parse::CPAN::Meta;
-
+
my $distmeta = Parse::CPAN::Meta->load_file('META.yml');
-
+
# Reading properties
my $name = $distmeta->{name};
my $version = $distmeta->{version};
my $metadata_structure = Parse::CPAN::Meta->load_json_string($json_string);
-This method deserializes the given string of JSON and the result.
+This method deserializes the given string of JSON and the result.
If the source was UTF-8 encoded, the string must be decoded before calling
C<load_json_string>.
must load correctly and must implement the C<Load()> function or an exception
will be thrown.
-=for :stopwords cpan testmatrix url annocpan anno bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan
-
-=head1 SUPPORT
-
-=head2 Bugs / Feature Requests
-
-Please report any bugs or feature requests through the issue tracker
-at L<https://github.com/Perl-Toolchain-Gang/Parse-CPAN-Meta/issues>.
-You will be notified automatically of any progress on your issue.
-
-=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<https://github.com/Perl-Toolchain-Gang/Parse-CPAN-Meta>
-
- git clone https://github.com/Perl-Toolchain-Gang/Parse-CPAN-Meta.git
-
=head1 AUTHORS
=over 4
=item *
-Adam Kennedy <adamk@cpan.org>
-
-=item *
-
David Golden <dagolden@cpan.org>
-=back
-
-=head1 CONTRIBUTORS
-
-=for stopwords Andreas Koenig David Golden Graham Knop Joshua ben Jore Karen Etheridge Matt S Trout Neil Bowers Ricardo Signes Steffen Mueller
-
-=over 4
-
-=item *
-
-Andreas Koenig <andk@cpan.org>
-
-=item *
-
-David Golden <xdg@xdg.me>
-
-=item *
-
-Graham Knop <haarg@haarg.org>
-
-=item *
-
-Joshua ben Jore <jjore@cpan.org>
-
-=item *
-
-Karen Etheridge <ether@cpan.org>
-
-=item *
-
-Matt S Trout <mst@shadowcat.co.uk>
-
-=item *
-
-Neil Bowers <neil@bowers.com>
-
=item *
Ricardo Signes <rjbs@cpan.org>
=item *
-Steffen Mueller <smueller@cpan.org>
+Adam Kennedy <adamk@cpan.org>
=back
=head1 COPYRIGHT AND LICENSE
-This software is copyright (c) 2016 by Adam Kennedy and Contributors.
+This software is copyright (c) 2010 by David Golden, Ricardo Signes, Adam Kennedy and Contributors.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
--- /dev/null
+There are three test data directories:
+
+- 'data-test': These files are valid META files that test *specific*
+ conversions and are expected to have specific data in them during
+ testing. Do not put new test data here unless you are sure it meets all
+ requirements needed to pass.
+
+- 'data-valid': These files are valid META files. Some may be improved by
+ the Converter (particularly upconverting from ancient specs).
+
+- 'data-fixable': These files are bad META files that fail validation, but
+ can be fixed via the Converter.
+
+- 'data-fail': These files are bad META files that fail validation and
+ can't be fixed.
use CPAN::Meta::Converter;
use File::Spec;
use IO::Dir;
-use Parse::CPAN::Meta 1.4400;
+use Parse::CPAN::Meta;
-delete $ENV{$_} for qw/PERL_JSON_BACKEND PERL_YAML_BACKEND/; # use defaults
+delete $ENV{PERL_YAML_BACKEND};
+delete $ENV{PERL_JSON_BACKEND};
+delete $ENV{CPAN_META_JSON_BACKEND};
+delete $ENV{CPAN_META_JSON_DECODER};
my @data_dirs = qw( t/data-valid t/data-fixable );
my @files = sort map {
use CPAN::Meta::Converter;
use File::Spec;
use IO::Dir;
-use Parse::CPAN::Meta 1.4400;
+use Parse::CPAN::Meta;
-delete $ENV{$_} for qw/PERL_JSON_BACKEND PERL_YAML_BACKEND/; # use defaults
+delete $ENV{PERL_YAML_BACKEND};
+delete $ENV{PERL_JSON_BACKEND};
+delete $ENV{CPAN_META_JSON_BACKEND};
+delete $ENV{CPAN_META_JSON_DECODER};
my $data_dir = IO::Dir->new( 't/data-fail' );
my @files = sort grep { /^\w/ } $data_dir->read;
use CPAN::Meta::Converter;
-delete $ENV{$_} for qw/PERL_JSON_BACKEND PERL_YAML_BACKEND/; # use defaults
+delete $ENV{PERL_YAML_BACKEND};
+delete $ENV{PERL_JSON_BACKEND};
+delete $ENV{CPAN_META_JSON_BACKEND};
+delete $ENV{CPAN_META_JSON_DECODER};
my $spec2 = {
version => '2',
use File::Spec;
use File::Basename qw/basename/;
use IO::Dir;
-use Parse::CPAN::Meta 1.4400;
+use Parse::CPAN::Meta;
-delete $ENV{$_} for qw/PERL_JSON_BACKEND PERL_YAML_BACKEND/; # use defaults
+delete $ENV{PERL_YAML_BACKEND};
+delete $ENV{PERL_JSON_BACKEND};
+delete $ENV{CPAN_META_JSON_BACKEND};
+delete $ENV{CPAN_META_JSON_DECODER};
# mock file object
package
--- /dev/null
+{
+ "abstract" : "Author tests making sure correct line endings are used",
+ "author" : [
+ "Florian Ragwitz <rafl@debian.org>",
+ "Caleb Cushing <xenoterracide@gmail.com>",
+ "Karen Etheridge <ether@cpan.org>"
+ ],
+ "dynamic_config" : 0,
+ "generated_by" : "Dist::Zilla version 5.035, CPAN::Meta::Converter version 2.150002",
+ "keywords" : [
+ "plugin",
+ "test",
+ "testing",
+ "author",
+ "development",
+ "whitespace",
+ "newline",
+ "linefeed",
+ "formatting"
+ ],
+ "license" : [
+ "perl_5"
+ ],
+ "meta-spec" : {
+ "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
+ "version" : 2
+ },
+ "name" : "Dist-Zilla-Plugin-Test-EOL",
+ "no_index" : {
+ "directory" : [
+ "t",
+ "xt"
+ ]
+ },
+ "prereqs" : {
+ "configure" : {
+ "requires" : {
+ "Module::Build::Tiny" : "0.039",
+ "perl" : "5.006"
+ }
+ },
+ "develop" : {
+ "recommends" : {
+ "Dist::Zilla::PluginBundle::Author::ETHER" : "0.092"
+ },
+ "requires" : {
+ "Dist::Zilla" : "5"
+ }
+ },
+ "runtime" : {
+ "requires" : {
+ "Data::Section" : "0.004",
+ "Dist::Zilla::File::InMemory" : "0",
+ "Dist::Zilla::Role::FileFinderUser" : "0",
+ "Dist::Zilla::Role::FileGatherer" : "0",
+ "Dist::Zilla::Role::FileMunger" : "0",
+ "Dist::Zilla::Role::PrereqSource" : "0",
+ "Dist::Zilla::Role::TextTemplate" : "0",
+ "Moose" : "0",
+ "Moose::Util::TypeConstraints" : "0",
+ "Path::Tiny" : "0",
+ "Sub::Exporter::ForMethods" : "0",
+ "namespace::autoclean" : "0",
+ "perl" : "5.006",
+ "strict" : "0",
+ "warnings" : "0"
+ }
+ },
+ "build" : {
+ "requires" : {
+ "Build::Requires": "1.1",
+ "Test::More" : "0"
+ }
+ },
+ "test" : {
+ "recommends" : {
+ "CPAN::Meta" : "2.120900"
+ },
+ "requires" : {
+ "Test::More" : "0.88",
+ "Test::Requires" : "1.2"
+ }
+ }
+ },
+ "provides" : {
+ "Dist::Zilla::Plugin::EOLTests" : {
+ "file" : "lib/Dist/Zilla/Plugin/EOLTests.pm",
+ "version" : "0.18",
+ "x_deprecated" : 1
+ },
+ "Dist::Zilla::Plugin::Test::EOL" : {
+ "file" : "lib/Dist/Zilla/Plugin/Test/EOL.pm",
+ "version" : "0.18"
+ }
+ },
+ "release_status" : "stable",
+ "resources" : {
+ "bugtracker" : {
+ "mailto" : "bug-Dist-Zilla-Plugin-Test-EOL@rt.cpan.org",
+ "web" : "https://rt.cpan.org/Public/Dist/Display.html?Name=Dist-Zilla-Plugin-Test-EOL"
+ },
+ "homepage" : "https://github.com/karenetheridge/Dist-Zilla-Plugin-Test-EOL",
+ "repository" : {
+ "type" : "git",
+ "url" : "https://github.com/karenetheridge/Dist-Zilla-Plugin-Test-EOL.git",
+ "web" : "https://github.com/karenetheridge/Dist-Zilla-Plugin-Test-EOL"
+ },
+ "x_IRC" : "irc://irc.perl.org/#distzilla",
+ "x_MailingList" : "http://dzil.org/#mailing-list"
+ },
+ "version" : "0.18",
+ "x_Dist_Zilla" : {
+ "perl" : {
+ "version" : "5.021010"
+ },
+ "plugins" : [
+ {
+ "class" : "Dist::Zilla::Plugin::Bootstrap::lib",
+ "config" : {
+ "Dist::Zilla::Role::Bootstrap" : {
+ "try_built" : null
+ }
+ },
+ "name" : "Bootstrap::lib",
+ "version" : "1.001000"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::VerifyPhases",
+ "name" : "@Author::ETHER/PHASE VERIFICATION",
+ "version" : "0.010"
+ }
+ ],
+ "zilla" : {
+ "class" : "Dist::Zilla::Dist::Builder",
+ "config" : {
+ "is_trial" : ""
+ },
+ "version" : "5.035"
+ }
+ },
+ "x_authority" : "cpan:FLORA",
+ "x_authority_from_module" : "Dist::Zilla::Plugin::Test::EOL",
+ "x_contributors" : [
+ "Olivier Mengue <dolmen@cpan.org>",
+ "Shlomi Fish <shlomif@shlomifish.org>"
+ ],
+ "x_permissions_from_module" : "Dist::Zilla::Plugin::Test::EOL"
+}
--- /dev/null
+---
+X_deep:
+ deep: structure
+abstract: 'Build and install Perl modules'
+author:
+ - 'Ken Williams <kwilliams@cpan.org>'
+ - 'Module-Build List <module-build@perl.org>'
+build_requires:
+ Test::More: '0'
+dynamic_config: 1
+generated_by: 'Module::Build version 0.36, CPAN::Meta::Converter version $VERSION'
+keywords:
+ - toolchain
+ - cpan
+ - dual-life
+license: perl
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-v1.4.html
+ version: '1.4'
+name: Module-Build
+optional_features:
+ domination:
+ description: 'Take over the world'
+ requires:
+ Machine::Weather: '2.0'
+recommends:
+ Archive::Tar: '1.00'
+ ExtUtils::Install: '0.3'
+ ExtUtils::ParseXS: '2.02'
+ Pod::Text: '0'
+ YAML: '0.35'
+requires:
+ Config: '0'
+ Cwd: '0'
+ Data::Dumper: '0'
+ ExtUtils::Install: '0'
+ File::Basename: '0'
+ File::Compare: '0'
+ File::Copy: '0'
+ File::Find: '0'
+ File::Path: '0'
+ File::Spec: '0'
+ IO::File: '0'
+ perl: '5.006'
+resources:
+ license: http://dev.perl.org/licenses/
+version: '0.36'
+x_authority: cpan:FLORA
+x_serialization_backend: 'CPAN::Meta::YAML version 0.015'
--- /dev/null
+{
+ "X_deep" : {
+ "deep" : "structure"
+ },
+ "abstract" : "Build and install Perl modules",
+ "author" : [
+ "Ken Williams <kwilliams@cpan.org>",
+ "Module-Build List <module-build@perl.org>"
+ ],
+ "description" : "Module::Build is a system for building, testing, and installing Perl modules. It is meant to be an alternative to ExtUtils::MakeMaker... blah blah blah",
+ "dynamic_config" : 1,
+ "generated_by" : "Module::Build version 0.36",
+ "keywords" : [
+ "toolchain",
+ "cpan",
+ "dual-life"
+ ],
+ "license" : [
+ "perl_5"
+ ],
+ "meta-spec" : {
+ "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
+ "version" : "2"
+ },
+ "name" : "Module-Build",
+ "optional_features" : {
+ "domination" : {
+ "description" : "Take over the world",
+ "prereqs" : {
+ "develop" : {
+ "requires" : {
+ "Genius::Evil" : "1.234"
+ }
+ },
+ "runtime" : {
+ "requires" : {
+ "Machine::Weather" : "2.0"
+ }
+ }
+ }
+ }
+ },
+ "prereqs" : {
+ "build" : {
+ "requires" : {
+ "Test::More" : "0"
+ }
+ },
+ "runtime" : {
+ "recommends" : {
+ "Archive::Tar" : "1.00",
+ "ExtUtils::Install" : "0.3",
+ "ExtUtils::ParseXS" : "2.02",
+ "Pod::Text" : "0",
+ "YAML" : "0.35"
+ },
+ "requires" : {
+ "Config" : "0",
+ "Cwd" : "0",
+ "Data::Dumper" : "0",
+ "ExtUtils::Install" : "0",
+ "File::Basename" : "0",
+ "File::Compare" : "0",
+ "File::Copy" : "0",
+ "File::Find" : "0",
+ "File::Path" : "0",
+ "File::Spec" : "0",
+ "IO::File" : "0",
+ "perl" : "5.006"
+ }
+ }
+ },
+ "release_status" : "stable",
+ "resources" : {
+ "license" : [
+ "http://dev.perl.org/licenses/"
+ ]
+ },
+ "version" : "0.36",
+ "x_authority" : "cpan:FLORA",
+ "x_serialization_backend" : "JSON::PP version 2.27300"
+}
--- /dev/null
+---
+abstract: 'Author tests making sure correct line endings are used'
+author:
+ - 'Florian Ragwitz <rafl@debian.org>'
+ - 'Caleb Cushing <xenoterracide@gmail.com>'
+ - 'Karen Etheridge <ether@cpan.org>'
+build_requires:
+ Build::Requires: '1.1'
+ Test::More: '0.88'
+ Test::Requires: '1.2'
+configure_requires:
+ Module::Build::Tiny: '0.039'
+ perl: '5.006'
+dynamic_config: 0
+generated_by: 'Dist::Zilla version 5.035, CPAN::Meta::Converter version 2.150002'
+keywords:
+ - plugin
+ - test
+ - testing
+ - author
+ - development
+ - whitespace
+ - newline
+ - linefeed
+ - formatting
+license: perl
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-v1.4.html
+ version: '1.4'
+name: Dist-Zilla-Plugin-Test-EOL
+no_index:
+ directory:
+ - t
+ - xt
+provides:
+ Dist::Zilla::Plugin::EOLTests:
+ file: lib/Dist/Zilla/Plugin/EOLTests.pm
+ version: '0.18'
+ x_deprecated: 1
+ Dist::Zilla::Plugin::Test::EOL:
+ file: lib/Dist/Zilla/Plugin/Test/EOL.pm
+ version: '0.18'
+requires:
+ Data::Section: '0.004'
+ Dist::Zilla::File::InMemory: '0'
+ Dist::Zilla::Role::FileFinderUser: '0'
+ Dist::Zilla::Role::FileGatherer: '0'
+ Dist::Zilla::Role::FileMunger: '0'
+ Dist::Zilla::Role::PrereqSource: '0'
+ Dist::Zilla::Role::TextTemplate: '0'
+ Moose: '0'
+ Moose::Util::TypeConstraints: '0'
+ Path::Tiny: '0'
+ Sub::Exporter::ForMethods: '0'
+ namespace::autoclean: '0'
+ perl: '5.006'
+ strict: '0'
+ warnings: '0'
+resources:
+ IRC: irc://irc.perl.org/#distzilla
+ MailingList: http://dzil.org/#mailing-list
+ bugtracker: https://rt.cpan.org/Public/Dist/Display.html?Name=Dist-Zilla-Plugin-Test-EOL
+ homepage: https://github.com/karenetheridge/Dist-Zilla-Plugin-Test-EOL
+ repository: https://github.com/karenetheridge/Dist-Zilla-Plugin-Test-EOL.git
+version: '0.18'
+x_Dist_Zilla:
+ perl:
+ version: '5.021010'
+ plugins:
+ -
+ class: Dist::Zilla::Plugin::Bootstrap::lib
+ config:
+ Dist::Zilla::Role::Bootstrap:
+ try_built: ~
+ name: Bootstrap::lib
+ version: '1.001000'
+ -
+ class: Dist::Zilla::Plugin::VerifyPhases
+ name: '@Author::ETHER/PHASE VERIFICATION'
+ version: '0.010'
+ zilla:
+ class: Dist::Zilla::Dist::Builder
+ config:
+ is_trial: ''
+ version: '5.035'
+x_authority: cpan:FLORA
+x_authority_from_module: Dist::Zilla::Plugin::Test::EOL
+x_contributors:
+ - 'Olivier Mengue <dolmen@cpan.org>'
+ - 'Shlomi Fish <shlomif@shlomifish.org>'
+x_permissions_from_module: Dist::Zilla::Plugin::Test::EOL
sub _slurp { do { local(@ARGV,$/)=shift(@_); <> } }
-delete $ENV{$_} for qw/PERL_JSON_BACKEND PERL_YAML_BACKEND/; # use defaults
+delete $ENV{PERL_YAML_BACKEND};
+delete $ENV{PERL_JSON_BACKEND};
+delete $ENV{CPAN_META_JSON_BACKEND};
+delete $ENV{CPAN_META_JSON_DECODER};
my $data_dir = IO::Dir->new( 't/data-fixable' );
my @files = sort grep { /^\w/ } $data_dir->read;
use CPAN::Meta;
use CPAN::Meta::Merge;
+delete $ENV{PERL_YAML_BACKEND};
+delete $ENV{PERL_JSON_BACKEND};
+delete $ENV{CPAN_META_JSON_BACKEND};
+delete $ENV{CPAN_META_JSON_DECODER};
+
my %base = (
abstract => 'This is a test',
author => ['A.U. Thor'],
is(
eval { $merger->merge(\%base, { abstract => 'And now for something else' }) },
undef,
- 'Trying to merge different author gives an exception',
+ 'Trying to merge different abstract gives an exception',
);
like $@, qr/^Can't merge attribute abstract/, 'Exception looks right';
'Trying to merge a new key for provides.$module is permitted; identical values are preserved',
);
+my $extra_merger = CPAN::Meta::Merge->new(
+ default_version => '2',
+ extra_mappings => {
+ 'x_toolkit' => 'set_addition',
+ 'x_meta_meta' => {
+ name => 'identical',
+ tags => 'set_addition',
+ }
+ }
+);
+
+my $extra_results = $extra_merger->merge(\%base, {
+ x_toolkit => [ 'marble' ],
+ x_meta_meta => {
+ name => 'Test',
+ tags => [ 'Testing' ],
+ }
+ },
+ { x_toolkit => [ 'trike'],
+ x_meta_meta => {
+ name => 'Test',
+ tags => [ 'TDD' ],
+ }
+ }
+);
+
+my $expected_nested_extra = {
+ name => 'Test',
+ tags => [ 'Testing', 'TDD' ],
+};
+is_deeply($extra_results->{x_toolkit}, [ 'marble', 'trike' ], 'Extra mapping fields are merged');
+is_deeply($extra_results->{x_meta_meta}, $expected_nested_extra, 'Nested extra mapping fields are merged' );
+
+my $adds_to = sub {
+ my ($left, $right, $path) = @_;
+ if ($right !~ /^\Q$left\E/) {
+ die sprintf "Can't merge attribute %s: '%s' does not start with '%s'", join('.', @{$path}), $right, $left;
+ }
+ return $right;
+};
+
+$extra_merger = CPAN::Meta::Merge->new(default_version => '2', extra_mappings => { 'abstract' => \&$adds_to } );
+my $extra_results2 = $extra_merger->merge({ abstract => 'This is a test.'}, { abstract => 'This is a test. Includes more detail..' } );
+is($extra_results2->{abstract}, 'This is a test. Includes more detail..', 'Extra mapping fields overwrite existing mappings');
+my $extra_failure = eval { $extra_merger->merge({ abstract => 'This is a test.'}, { abstract => 'This is a better test.' } ) };
+is($extra_failure, undef, 'Extra mapping produces a failure');
+like $@, qr/does not start with/, 'Exception looks right';
+
+
# issue 67
@base{qw/name version release_status/} = qw/Foo-Bar 0.01 testing/;
use Test::More 0.88;
use CPAN::Meta;
-
+use Storable qw(dclone);
use Scalar::Util qw(blessed);
-delete $ENV{$_} for qw/PERL_JSON_BACKEND PERL_YAML_BACKEND/; # use defaults
+delete $ENV{PERL_YAML_BACKEND};
+delete $ENV{PERL_JSON_BACKEND};
+delete $ENV{CPAN_META_JSON_BACKEND};
+delete $ENV{CPAN_META_JSON_DECODER};
my $distmeta = {
name => 'Module-Build',
X_deep => { deep => 'structure' },
};
-my $meta = CPAN::Meta->new($distmeta);
+my $meta = CPAN::Meta->new(dclone $distmeta);
is(
blessed($meta->as_struct),
$chk_feature->( $meta->feature('domination') );
+
+sub read_file {
+ my $filename = shift;
+ open my $fh, '<', $filename;
+ local $/;
+ my $string = <$fh>;
+ $string =~ s/\$VERSION/$CPAN::Meta::VERSION/g;
+ $string;
+}
+
+sub clean_backends {
+ my $string = shift;
+ $string =~ s{"?generated_by.*}{};
+ $string =~ s{"?x_serialization_backend.*}{};
+ return $string;
+}
+
+is(
+ clean_backends($meta->as_string()),
+ clean_backends(read_file('t/data-valid/META-2.json')),
+ 'as_string with no arguments defaults to version 2 and JSON',
+);
+
+is(
+ clean_backends($meta->as_string({ version => 2 })),
+ clean_backends(read_file('t/data-valid/META-2.json')),
+ 'as_string using version 2 defaults to JSON',
+);
+
+is(
+ clean_backends($meta->as_string({ version => 1.4 })),
+ clean_backends(read_file('t/data-valid/META-1_4.yml')),
+ 'as_string using version 1.4 defaults to YAML',
+);
+
done_testing;
# vim: ts=2 sts=2 sw=2 et :
use CPAN::Meta;
-delete $ENV{$_} for qw/PERL_JSON_BACKEND PERL_YAML_BACKEND/; # use defaults
+delete $ENV{PERL_YAML_BACKEND};
+delete $ENV{PERL_JSON_BACKEND};
+delete $ENV{CPAN_META_JSON_BACKEND};
+delete $ENV{CPAN_META_JSON_DECODER};
my %distmeta = (
name => 'Module-Billed',
use CPAN::Meta;
use CPAN::Meta::Merge;
+delete $ENV{PERL_YAML_BACKEND};
+delete $ENV{PERL_JSON_BACKEND};
+delete $ENV{CPAN_META_JSON_BACKEND};
+delete $ENV{CPAN_META_JSON_DECODER};
+
my %base = (
abstract => 'This is a test',
author => ['A.U. Thor'],
### YAML tests
{
- local $ENV{PERL_YAML_BACKEND}; # ensure we get CPAN::META::YAML
+ local $ENV{PERL_YAML_BACKEND} if not $ENV{PERL_CORE}; # ensure we always get CPAN::META::YAML
is(Parse::CPAN::Meta->yaml_backend(), 'CPAN::Meta::YAML', 'yaml_backend(): CPAN::Meta::YAML');
my $from_yaml = Parse::CPAN::Meta->load_file( $meta_yaml );
}
{
- local $ENV{PERL_YAML_BACKEND}; # ensure we get CPAN::META::YAML
+ local $ENV{PERL_YAML_BACKEND} if not $ENV{PERL_CORE}; # ensure we always get CPAN::META::YAML
note '';
is(Parse::CPAN::Meta->yaml_backend(), 'CPAN::Meta::YAML', 'yaml_backend(): CPAN::Meta::YAML');
}
{
- local $ENV{PERL_YAML_BACKEND}; # ensure we get CPAN::META::YAML
+ local $ENV{PERL_YAML_BACKEND} if not $ENV{PERL_CORE}; # ensure we always get CPAN::META::YAML
note '';
is(Parse::CPAN::Meta->yaml_backend(), 'CPAN::Meta::YAML', 'yaml_backend(): CPAN::Meta::YAML');
}
{
- local $ENV{PERL_YAML_BACKEND}; # ensure we get CPAN::META::YAML
+ local $ENV{PERL_YAML_BACKEND} if not $ENV{PERL_CORE}; # ensure we always get CPAN::META::YAML
note '';
is(Parse::CPAN::Meta->yaml_backend(), 'CPAN::Meta::YAML', 'yaml_backend(): CPAN::Meta::YAML');
}
{
- local $ENV{PERL_YAML_BACKEND}; # ensure we get CPAN::META::YAML
+ local $ENV{PERL_YAML_BACKEND} if not $ENV{PERL_CORE}; # ensure we always get CPAN::META::YAML
note '';
is(Parse::CPAN::Meta->yaml_backend(), 'CPAN::Meta::YAML', 'yaml_backend(): CPAN::Meta::YAML');
}
{
- local $ENV{PERL_YAML_BACKEND}; # ensure we get CPAN::META::YAML
+ local $ENV{PERL_YAML_BACKEND} if not $ENV{PERL_CORE}; # ensure we always get CPAN::META::YAML
note '';
is(Parse::CPAN::Meta->yaml_backend(), 'CPAN::Meta::YAML', 'yaml_backend(): CPAN::Meta::YAML');
SKIP: {
note '';
+ skip 'these tests are for cpan builds only', 2 if $ENV{PERL_CORE};
skip "YAML module not installed", 2
unless eval "require YAML; 1";
local $ENV{PERL_YAML_BACKEND} = 'YAML';
### JSON tests
{
# JSON tests with JSON::PP
- local $ENV{PERL_JSON_BACKEND}; # ensure we get JSON::PP
+ local $ENV{PERL_JSON_BACKEND} if not $ENV{PERL_CORE}; # ensure we always get JSON::PP
note '';
is(Parse::CPAN::Meta->json_backend(), 'JSON::PP', 'json_backend(): JSON::PP');
{
# JSON tests with JSON::PP
- local $ENV{PERL_JSON_BACKEND}; # ensure we get JSON::PP
+ local $ENV{PERL_JSON_BACKEND} if not $ENV{PERL_CORE}; # ensure we always get JSON::PP
note '';
is(Parse::CPAN::Meta->json_backend(), 'JSON::PP', 'json_backend(): JSON::PP');
{
# JSON tests with JSON::PP
- local $ENV{PERL_JSON_BACKEND}; # ensure we get JSON::PP
+ local $ENV{PERL_JSON_BACKEND} if not $ENV{PERL_CORE}; # ensure we always get JSON::PP
note '';
is(Parse::CPAN::Meta->json_backend(), 'JSON::PP', 'json_backend(): JSON::PP');
{
# JSON tests with JSON::PP, take 2
- local $ENV{PERL_JSON_BACKEND} = 0; # request JSON::PP
+ local $ENV{PERL_JSON_BACKEND} = 0 if not $ENV{PERL_CORE}; # request JSON::PP
note '';
is(Parse::CPAN::Meta->json_backend(), 'JSON::PP', 'json_backend(): JSON::PP');
{
# JSON tests with JSON::PP, take 3
- local $ENV{PERL_JSON_BACKEND} = 'JSON::PP'; # request JSON::PP
+ local $ENV{PERL_JSON_BACKEND} = 'JSON::PP' if not $ENV{PERL_CORE}; # request JSON::PP
note '';
is(Parse::CPAN::Meta->json_backend(), 'JSON::PP', 'json_backend(): JSON::PP');
is_deeply($from_json, $want, "load_json_string with PERL_JSON_BACKEND = 'JSON::PP'");
}
-{
+SKIP: {
# JSON tests with fake backend
+
+ note '';
+ skip 'these tests are for cpan builds only', 2 if $ENV{PERL_CORE};
+
{ package MyJSONThingy; $INC{'MyJSONThingy.pm'} = __FILE__; require JSON::PP;
sub decode_json { JSON::PP::decode_json(@_) } }
local $ENV{CPAN_META_JSON_DECODER} = 'MyJSONThingy'; # request fake backend
- note '';
is(Parse::CPAN::Meta->json_decoder(), 'MyJSONThingy', 'json_decoder(): MyJSONThingy');
my $json = load_ok( $meta_json, $meta_json, 100, ":encoding(UTF-8)");
my $from_json = Parse::CPAN::Meta->load_json_string( $json );
SKIP: {
note '';
+ skip 'these tests are for cpan builds only', 2 if $ENV{PERL_CORE};
skip "JSON module version 2.5 not installed", 2
unless eval "require JSON; JSON->VERSION(2.5); 1";
local $ENV{PERL_JSON_BACKEND} = 1;
use CPAN::Meta::Prereqs;
-delete $ENV{$_} for qw/PERL_JSON_BACKEND PERL_YAML_BACKEND/; # use defaults
+delete $ENV{PERL_YAML_BACKEND};
+delete $ENV{PERL_JSON_BACKEND};
+delete $ENV{CPAN_META_JSON_BACKEND};
+delete $ENV{CPAN_META_JSON_DECODER};
sub dies_ok (&@) {
my ($code, $qr, $comment) = @_;
use CPAN::Meta::Prereqs;
-delete $ENV{$_} for qw/PERL_JSON_BACKEND PERL_YAML_BACKEND/; # use defaults
+delete $ENV{PERL_YAML_BACKEND};
+delete $ENV{PERL_JSON_BACKEND};
+delete $ENV{CPAN_META_JSON_BACKEND};
+delete $ENV{CPAN_META_JSON_DECODER};
my $prereq_struct_1 = {
runtime => {
requires => {
'Test' => 0,
},
- }
+ x_type => {
+ 'Config' => 1,
+ },
+ },
+ x_phase => {
+ x_type => {
+ 'POSIX' => '1.23',
+ },
+ },
};
my $prereq_1 = CPAN::Meta::Prereqs->new($prereq_struct_1);
suggests => {
'Module::Build::Bob' => '20100101',
},
- }
+ },
+ x_phase => {
+ requires => {
+ 'JSON::PP' => '2.34',
+ },
+ },
};
my $prereq_2 = CPAN::Meta::Prereqs->new($prereq_struct_2);
suggests => {
'Module::Build::Bob' => '20100101',
},
+ x_type => {
+ 'Config' => 1,
+ },
+ },
+ x_phase => {
+ requires => {
+ 'JSON::PP' => '2.34',
+ },
+ x_type => {
+ 'POSIX' => '1.23',
+ },
},
};
use CPAN::Meta::Prereqs;
-delete $ENV{$_} for qw/PERL_JSON_BACKEND PERL_YAML_BACKEND/; # use defaults
+delete $ENV{PERL_YAML_BACKEND};
+delete $ENV{PERL_JSON_BACKEND};
+delete $ENV{CPAN_META_JSON_BACKEND};
+delete $ENV{CPAN_META_JSON_DECODER};
my $prereq_struct = {
runtime => {
requires => {
'Test' => 0,
},
- }
+ x_type => {
+ 'Config' => 1,
+ },
+ },
+ x_phase => {
+ requires => {
+ 'JSON::PP' => '2.34',
+ },
+ x_type => {
+ 'POSIX' => '1.23',
+ },
+ },
};
my $prereq = CPAN::Meta::Prereqs->new($prereq_struct);
use CPAN::Meta;
-delete $ENV{$_} for qw/PERL_JSON_BACKEND PERL_YAML_BACKEND/; # use defaults
+delete $ENV{PERL_YAML_BACKEND};
+delete $ENV{PERL_JSON_BACKEND};
+delete $ENV{CPAN_META_JSON_BACKEND};
+delete $ENV{CPAN_META_JSON_DECODER};
# 1.4 repository upgrade
{
use CPAN::Meta;
use File::Temp 0.20 ();
-use Parse::CPAN::Meta 1.4400;
+use Parse::CPAN::Meta;
-delete $ENV{$_} for qw/PERL_JSON_BACKEND PERL_YAML_BACKEND/; # use defaults
+delete $ENV{PERL_YAML_BACKEND};
+delete $ENV{PERL_JSON_BACKEND};
+delete $ENV{CPAN_META_JSON_BACKEND};
+delete $ENV{CPAN_META_JSON_DECODER};
my $distmeta = {
name => 'Module-Build',
use CPAN::Meta::Validator;
use File::Spec;
use IO::Dir;
-use Parse::CPAN::Meta 1.4400;
+use Parse::CPAN::Meta;
-delete $ENV{$_} for qw/PERL_JSON_BACKEND PERL_YAML_BACKEND/; # use defaults
+delete $ENV{PERL_YAML_BACKEND};
+delete $ENV{PERL_JSON_BACKEND};
+delete $ENV{CPAN_META_JSON_BACKEND};
+delete $ENV{CPAN_META_JSON_DECODER};
{
my @data_dirs = qw( t/data-test t/data-valid );
'../cpan/Locale-Codes' => 1,
'../cpan/Module-Load' => 1,
'../cpan/Module-Load-Conditional' => 1,
- '../cpan/Parse-CPAN-Meta' => 1,
'../cpan/Pod-Simple' => 1,
'../cpan/Test-Simple' => 1,
'../cpan/podlators' => 1,
'../cpan/IO-Compress' => 1,
'../cpan/MIME-Base64' => 1,
'../cpan/parent' => 1,
- '../cpan/Parse-CPAN-Meta' => 1,
'../cpan/Pod-Simple' => 1,
'../cpan/podlators' => 1,
'../cpan/Test-Simple' => 1,