cpm icon indicating copy to clipboard operation
cpm copied to clipboard

Resolve script name?

Open perlancar opened this issue 9 years ago • 2 comments

Hi Shoichi,

This is just a random idea that you might want to consider.

Often I want to install a script from CPAN, but I don't know the name of the module. So I need to open browser, go to metacpan.org, and search for it (or, use my local CPAN mirror tool lcpan and type lcpan script2mod SCRIPTNAME).

Since now cpm has resolver modules, perhaps a resolver module can be written so that something like:

% cpm install csv-add-field

can be resolved to:

% cpm install App::CSVUtils

I've also written a simple script to demonstrate this for cpanm:

https://metacpan.org/source/PERLANCAR/App-cpanm-script-0.001/bin/cpanm-script

Please tell me what you think. I'm open to writing a separately distributed App::cpm::Resolver::* by myself.

perlancar avatar Nov 01 '16 19:11 perlancar

That sounds interesting! PR welcome.

I'm not sure but if fastapi.metacpan.org has an API that resolves dist uris or module names from script names and returns results as JSON format, we prefer it.

skaji avatar Nov 02 '16 00:11 skaji

I'm not sure but if fastapi.metacpan.org has an API that resolves dist uris or module names from script names and returns results as JSON format, we prefer it.

Not that I know of. Using the /pod endpoint doesn't even guarantee that we'll get the release tarball URL, so I had to scrape the HTML version at https://metacpan.org/pod/NAME.

perlancar avatar Nov 02 '16 02:11 perlancar