X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FModule%2FMetadata.pm;fp=lib%2FModule%2FMetadata.pm;h=189fbf952a1d7199e2acfe3a0f866c2ba1575d9b;hb=c06d018717d6870aa177e0593f2220bcb1a130be;hp=52394a3beda58c20527ea7f0ff53ddaa8b122573;hpb=55d80de469579d71eb9566831ca9024b001e44f0;p=p5sagit%2FModule-Metadata.git diff --git a/lib/Module/Metadata.pm b/lib/Module/Metadata.pm index 52394a3..189fbf9 100644 --- a/lib/Module/Metadata.pm +++ b/lib/Module/Metadata.pm @@ -169,6 +169,12 @@ sub new_from_module { die "provides() takes only one of 'dir' or 'files'\n" if $args{dir} && $args{files}; + die "provides() requires a 'version' argument" + unless defined $args{version}; + + die "provides() does not support version '$args{version}' metadata" + unless grep { $args{version} eq $_ } qw/1.4 2/; + $args{prefix} = 'lib' unless defined $args{prefix}; my $p; @@ -706,7 +712,9 @@ Module::Metadata - Gather package and POD information from perl module files my $version = $info->version; # CPAN META 'provides' field for .pm files in a directory - my $provides = Module::Metadata->provides(dir => 'lib'); + my $provides = Module::Metadata->provides( + dir => 'lib', version => 2 + ); =head1 DESCRIPTION @@ -767,6 +775,16 @@ pairs. Valid option keys include: =over +=item version B<(required)> + +Specifies which version of the L should be used as +the format of the C output. Currently only '1.4' and '2' +are supported (and their format is identical). This may change in +the future as the definition of C changes. + +The C option is required. If it is omitted or if +an unsupported version is given, then C will throw an error. + =item dir Directory to search recursively for F<.pm> files. May not be specified with