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