5

Suppose that, as a private project, I have implemented a Perl package, and tested it, both formally and through extensive everyday use. I find the package useful and solid enough to warrant submitting it to CPAN.

Up to this point, since the package has been a private project, I have not worried too much about the package's name, but now that I want to submitted to CPAN, however, I would like the package's name to fit well within the ecology of package names already in CPAN.

In order to find a suitable "CPAN name" for my package, I would have to inspect a comprehensive listing of all these package names1.

What is the simplest way to get this comprehensive listing of names of packages in CPAN?


ObPedantry

(IOW, if the question above is already clear enough for you, you may safely ignore what follows.)

I don't think that I can give a technically correct formal definition of what I mean here by "package name", so let me at least give an "operational definition".

If, for example, the one-liner

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

fails with an error beginning 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'll say that "Foo::Bar::Baz is a package name in CPAN".

(We could split hairs over the package/module distinction, and consider scenarios in which the distinction matters, but please let's not.)

Furthermore, if after inspecting the list this question asks about I discover that, on the one hand, there are in fact many eminent package names in CPAN that begin with the prefix Foo::Bar::, and on the other, there are none (or negligibly few) that begin with the prefix Fubar::, then this would be a good enough reason for me to change the name of my Fubar::Frobozz package to Foo::Bar::Frobozz before submitting it to CPAN.


1 Of course, after inspecting such a list, I may discover that my package does not add sufficiently new functionality relative to what's already available in CPAN to warrant submitting my package to CPAN after all.

kjo
  • 33,683
  • 52
  • 148
  • 265
  • 4
    See [index of uploaded modules](http://www.cpan.org/modules/01modules.index.html), [Perl5 registered modules list](http://www.cpan.org/modules/00modlist.long.html) and [On The Naming of Modules](https://pause.perl.org/pause/query?ACTION=pause_namingmodules). – Steffen Ullrich Feb 24 '17 at 14:04

4 Answers4

4

PAUSE::Packages can do what you want, however you probably want to use this list, but http://prepan.org/ can provide advice/review before submission to cpan, with of course reading on the naming of modules first.

Dr.Avalanche
  • 1,944
  • 2
  • 28
  • 37
  • `PAUSE::Packages` is enormous! It's not as bad as, say, `Moose`, but you could almost fill your time sheet for the day with *installing `PAUSE::Packages`*! Also note that the author **Neil Bowers** said *"NOTE: this is very much an alpha release"* back in October 2015. – Borodin Feb 24 '17 at 15:50
  • installed in less than a minute here. Also, why not kick off module installs and check them when they're done, rather than 'fill your time sheet for the day' watching things happen? – Dr.Avalanche Feb 24 '17 at 15:56
  • it's not been updated since 2015, it's been in alpha for a while. Is it abandoned? Who knows. I provided a link to the data they need for easy access. – Dr.Avalanche Feb 24 '17 at 15:58
  • I was simply adding information. I didn't expect you to take it as a personal attack! – Borodin Feb 24 '17 at 19:25
  • @Borodin I didn't, simply replied to your comment, and the edit – Dr.Avalanche Feb 27 '17 at 15:51
4

Are you sure that's a thing you want? There are 33,623 distributions on CPAN at the time of writing. Within cpan you can enter

cpan> d /./

That's d for distributions followed by a regex pattern that matches the names you're interested in

If you're really interested in packages -- and a distribution may contain multiple package names -- you need

cpan> m/./

where m is for modules. There are 163,136 of those, which means there's an average of four or five packages per distribution, and it takes cpan a few minutes to generate the list. (I'm sorry, I didn't monitor the exact time.)

Borodin
  • 126,100
  • 9
  • 70
  • 144
4

If you have run cpan before, you have downloaded a comprehensive package and distribution list under <cpan-home>/sources/modules/02packages.details.txt.gz.

A fresh copy is available on any CPAN mirror, e.g. http://www.cpan.org/modules/02packages.details.txt.gz .

mob
  • 117,087
  • 18
  • 149
  • 283
0

You could use MetaCPAN::Client

I found this article which gives the idea about 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 "%s v%s\n", $release->distribution, $release->version;
}

Currently this gave me 32601 result like this:

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

This modules also gives information about release, module, author, and file & uses Elasticsearch.

It also get updated regularly on every MetaCPAN API change.

AbhiNickz
  • 1,035
  • 2
  • 14
  • 32