- new is_indexable() object method (ether, RT#84357)
- removed cruft in test infrastructure left behind from separation from
Module::Build (ether)
+ - fixed broken provides() where a list of files is passed (ether)
1.000019 2013-10-06
- warnings now disabled inside during the evaluation of generated version
croak "provides() takes only one of 'dir' or 'files'\n"
if $args{dir} && $args{files};
+ croak "provides() takes only one of 'files' or 'prefix'\n"
+ if $args{files} && $args{prefix};
+
croak "provides() requires a 'version' argument"
unless defined $args{version};
else {
croak "provides() requires 'files' to be an array reference\n"
unless ref $args{files} eq 'ARRAY';
- $p = $class->package_versions_from_directory($args{files});
+ $p = $class->package_versions_from_directory('', $args{files});
}
# Now, fix up files with prefix
- if ( length $args{prefix} ) { # check in case disabled with q{}
+ if ( not $args{files} and length $args{prefix} ) { # check in case disabled with q{}
$args{prefix} =~ s{/$}{};
for my $v ( values %$p ) {
$v->{file} = "$args{prefix}/$v->{file}";
=item files
-Array reference of files to examine. May not be specified with C<dir>.
+Array reference of files to examine. May not be combined with C<dir> or
+C<prefix>.
=item prefix
String to prepend to the C<file> field of the resulting output. This defaults
to F<lib>, which is the common case for most CPAN distributions with their
F<.pm> files in F<lib>. This option ensures the META information has the
-correct relative path even when the C<dir> or C<files> arguments are
-absolute or have relative paths from a location other than the distribution
+correct relative path even when the C<dir> argument is
+absolute or has relative paths from a location other than the distribution
root.
=back
);
my %pkg_names = reverse @pkg_names;
-plan tests => 63 + (2 * keys( %modules )) + (2 * keys( %pkg_names ));
+plan tests => 64 + (2 * keys( %modules )) + (2 * keys( %pkg_names ));
require_ok('Module::Metadata');
}
};
- is_deeply( $got_provides, $exp_provides, "provides()" )
+ is_deeply( $got_provides, $exp_provides, "provides(dir => ...)" )
+ or diag explain $got_provides;
+
+ $got_provides = Module::Metadata->provides(files => ['lib/Simple.pm'], version => 2);
+ is_deeply( $got_provides, $exp_provides, "provides(files => ...)" )
or diag explain $got_provides;
}
}
};
- is_deeply( $got_provides, $exp_provides, "provides()" )
+ is_deeply( $got_provides, $exp_provides, "provides(dir => ..., prefix => ...)" )
or diag explain $got_provides;
}
}