perlancar has asked for the wisdom of the Perl Monks concerning the following question:

I wonder why the CPAN distribution metadata does not define a more general 'provides' to let a distribution specifies the list of scripts or other documents that it contains, in addition to packages. It would make things easier for tools like MetaCPAN, or App::lcpan. Right now I believe (not confirmed yet by reading the source code) that MetaCPAN performs some static parsing of Makefile.PL to get EXE_FILES, but less-than-straightforward declaration of EXE_FILES will make it miss (example: Spreadsheet-Read's Makefile.PL).
  • Comment on Listing scripts in distribution metadata

Replies are listed 'Best First'.
Re: Listing scripts in distribution metadata
by tobyink (Canon) on Oct 27, 2020 at 23:56 UTC

    I've been using an x_provides_scripts hash in META.json, modelled after the standard provides hash. So say your distribution provides a "csv2json" script, your META.json would contain:

    "x_provides_scripts": { "csv2json": { "version": "0.1", "file": "bin/csv2json" } }
      Perfect. I'll be adding a support for x_provides_scripts in App::lcpan. I've also started to document the list of custom keys like this in CPAN::Meta::X.