Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module::Metadata is confused by Fatpack archives #18

Open
grtodd opened this issue Apr 12, 2015 · 2 comments
Open

Module::Metadata is confused by Fatpack archives #18

grtodd opened this issue Apr 12, 2015 · 2 comments

Comments

@grtodd
Copy link

grtodd commented Apr 12, 2015

Module::Metadata 's package_versions_from_directory() is confused by the existence of a fatscript.pm file in the directory being searched. The function pushes modules into the results that are inside the fatscript.pm: POD examples, etc. The fatscript.pm in question comes from from my cpanminus install and was made by App::FatPacker.

/home/myuser/perl5/lib/perl5/App/cpanminus/fatscript.pm

You can see this if you grab the file explicitly with new_from_file()

  % cd ~/perl5
  % perl -MData::Dumper -MModule::Metadata -E '
      $pm_info = Module::Metadata->new_from_file("App/cpanminus/fatscript.pm" ); 
      print Dumper \$pm_info ;'

It was suggested that the fatscript code was confusing Module::Metadata by the use of HERE style documents: the output shows "A" "My" "YourModule" etc. which all come from POD examples. Perhaps embedded fatpacked modules should ibe excluded by Module::Metadata somehow on a default run (via the call to wanted in the find() from package_versions_from_directory) and flagged as fatpacked with embedded modules and then either special cased (package_versions_from_fatpack) or the output only available when a constructor option is passed. In any case the incorrectly included POD example modules in the fatpacked file should be handled more correctly.

@karenetheridge
Copy link
Member

I think it would probably be reasonable for the caller of package_versions_from_directory to pass a list of filenames (or regexes perhaps, or File::Find rules - details to bikeshed later) to skip over when scanning for packages and versions. You could list fatscript.pm there, or the inc dir, etc.

@grtodd
Copy link
Author

grtodd commented Apr 14, 2015

I guess that would marginally speed things up too?

Since the "skip list" would be a subset of *.pm files this seems like the easiest "first pass" approach. Of course it would be useful to interrogate fatpacked applications (e.g. those that include something like fatscript.pm) so enhancing Module::Metadata to be able do that correctly - maybe with a separate function like .package_versions_in_fatpack/archive() - would be great. This could make M::M useful to users (or authors?) of App::Fatpacker, App::Packer::PAR, etc. in some way ...

I will add a more useful version of this issue toModule::Metadata's RT.cpan.org bug queue ... eventually ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants