Subject: | "Virtual" (InMemory or FromCode) files cannot be read by Module::MetaData |
Hi there,
It's possible I'm doing something wrong here, but this seems like a bug:
Calling ->new_from_file expects that the parameter will be a regular file on disk that can be opened and read:
Module::Metadata->new_from_file($_->name)->name
(https://metacpan.org/source/ETHER/Dist-Zilla-Plugin-Test-NewVersion-0.002/lib/Dist/Zilla/Plugin/Test/NewVersion.pm#L57)
However, other plugins may have added files which aren't ::OnDisk, for example ::InMemory or ::FromCode. That method is doing so a few lines further down, for example, and http://dzil.org/tutorial/writing-plugins.html makes me think that's legitimate expected behaviour at the gather_files stage.
So: should @files perhaps be filtered to check for -r or maybe even ->isa('Dist::Zilla::File::OnDisk'), so that those 'virtual' files can be ignored?
The specific failure case I'm seeing is with this:
[PodInherit]
[Test::NewVersion]
resulting in the following error:
[PodInherit] Generated 16 POD files
Can't call method "name" on an undefined value at .../site_perl/5.16.3/Dist/Zilla/Plugin/Test/NewVersion.pm line 56, <DATA> line 23.
(->name is called twice on that line, but the undefined value is the Module::Metadata->new_from_file return value, rather than $_)
however it works if you put them the other way around:
[Test::NewVersion]
[PodInherit]
cheers,
Tom