Subject: | Plugin fails to read MANIFEST if $self->zilla->root is absolute. |
My plugin bundle uses GatherFromManifest plugin. I wrote a test on the bundle, and the test fails with error message:
Problem opening /home/vdb/prj/perl-Dist-Zilla-PluginBundle-Author-VDB/.build/rTE1KhhCGU/tmp/4M7zyqKzG8/source/home/vdb/prj/perl-Dist-Zilla-PluginBundle-Author-VDB/.build/rTE1KhhCGU/tmp/4M7zyqKzG8/source/MANIFEST: No such file or directory at /usr/share/perl5/vendor_perl/ExtUtils/Manifest.pm line 349.
You see that dir part of the path is repeated twice. The problem is in GatherFromManifest code, in gather_dir function:
sub gather_files {
my ($self) = @_;
my $manifest = $self->zilla->root->file( $self->manifest );
unless (-f $manifest) {
$self->log_fatal("Cannot read manifest file: ", $manifest);
}
my $root = "" . $self->root;
$root =~ s{^~([\\/])}{File::HomeDir->my_home . $1}ex;
$root = Path::Class::dir($root);
$manifest = File::Spec->catdir($root, $manifest);
If $self->zilla->root is not current directory (".") but an absolute path, original value of the $manifest variable will be absolute path too. In the last line of sample above, absolute $manifest will be prepended with $root one more time, causing invalid manifest path.