The easiest way to get a complete list of package names available in CPAN?

Suppose, as a private project, I implemented the Perl package and tested it both formally and through widespread daily use. I believe the package is useful and strong enough to guarantee that it will be sent to CPAN.

Up to this point, since the package was a private project, I did not worry too much about the package name, but now that I want to send to CPAN, I would like the package name to fit well with the package name ecology already in CPAN.

To find a suitable “CPAN name” for my package, I will need to look at the complete list of all these package names 1 .

What is the easiest way to get a complete list of package names in CPAN?


ObPedantry

(IOW, if the above question is already clear enough for you, you can safely ignore the following).

I don’t think I can give a technically correct formal definition of what I mean here under the name "package name", so let me at least give a "real-time definition".

If, for example, single-line

$ perl -MFoo::Bar::Baz -c -e 1 

with an error starting with

 Can't locate Foo/Bar/Baz.pm in @INC ... 

... but after installing some distributions from CPAN, the same oneliner succeeds with

 -e syntax OK 

... then I will say that " Foo::Bar::Baz is the name of the package in CPAN."

(We could divide the hair into the difference between packages and modules and consider scenarios in which the difference matters, but please do not allow it.)

In addition, if after checking the list in this question a question arises, I found that, on the one hand, there are actually many eminent package names in CPAN that start with the prefix Foo::Bar:: , and on the other, not ( or negligible) that start with the Fubar:: prefix, then for me it would be a good reason to change the name of my package Fubar::Frobozz to Foo::Bar::Frobozz before sending it to CPAN.


1 Of course, after checking such a list, I may find that my package does not add enough new features regarding what is already available in CPAN to guarantee that my package will be sent to CPAN after all.

+5
source share
4 answers

If you started cpan earlier, you downloaded the full package and mailing list in the <cpan-home>/sources/modules/02packages.details.txt.gz .

A new copy is available on any CPAN mirror, for example. http://www.cpan.org/modules/02packages.details.txt.gz .

+4
source

PAUSE :: Packages can do what you want, however you probably want to use this list , but http://prepan.org/ can provide advice / review before posting to cpan, of course by reading the names of the modules .

+4
source

Are you sure the thing you want? At the time of writing, CPAN has 33,623 distributions. Within cpan you can enter

 cpan> d /./ 

This is d for distributions followed by a regular expression pattern matching the names that interest you

If you are really interested in packages - and the distribution may contain several package names - you need

 cpan> m/./ 

where m for modules. There are 163,136 of them, which means that on average there are four or five packages for each distribution, and cpan several minutes to create a list. (Sorry, I did not control the exact time.)

+4
source

You can use MetaCPAN :: Client

I found this article which gives an idea of ​​using this module.

 #!/usr/bin/perl use strict; use warnings; use MetaCPAN::Client; my $mcpan = MetaCPAN::Client->new(); my $release_results = $mcpan->release({ status => 'latest' } ); while ( my $release = $release_results->next ) { printf "%sv%s\n", $release->distribution, $release->version; } 

Currently, this has given me the result of 32601 :

 Proc-tored v0.11 Locale-Utils-PlaceholderBabelFish v0.004 Perinci-To-Doc v0.83 Mojolicious-Plugin-Qooxdoo v0.905 App-cdnget v0.05 Baal-Parser v0.01 Acme-DoOrDie v0.001 Net-Shadowsocks v0.9.0 MetaCPAN-Client v2.006000 

These modules also provide release, module, author, and file information and use Elasticsearch .

It is also regularly updated with every change to the MetaCPAN API.

0
source

Source: https://habr.com/ru/post/1264686/


All Articles