lcpan tips 004: Who mentions my modules/scripts?

About this series: a collection of short, daily blog posts about lcpan tips/recipes. Some posts will also end up in the upcoming App::lcpan::Manual::Cookbook POD to be included in the App-lcpan distribution.

About lcpan: an application to download and index a mini CPAN mirror on your local filesystem, so in effect you will have something like your own CPAN with a command-line tool (or perl API) to query and extract information from your mirror. I find it perfect for my own personal use when working offline.

Since 0.67, lcpan indexes scripts in addition to modules. To do this, lcpan uses a heuristic: all files inside release tarballs that have paths matching ^([^/]+/)?(bin/scripts?)/([^/]+)$. It might miss a few and also get a few false-positives. But the alternative way of parsing Makefile.PL (e.g. from WriteMakefile argument EXE_FILES) is considered unsafe.

Also since 0.67, lcpan parses POD of .pm/.pod files and scripts (extracted from release tarballs) and indexes POD links as well as module names that are mentioned in the PODs.

To view this information from the command-line, lcpan provides the mentions subcommand. For example, to list who mentions my module Text::ANSITable:

% lcpan mentions --mentioned-module Text::ANSITable
+-----------------+---------------+-----------------------------------------------+------------------+---------------------------------------------------------------------------------+
| module          | module_author | release                                       | mentioner_author | content_path                                                                    |
+-----------------+---------------+-----------------------------------------------+------------------+---------------------------------------------------------------------------------+
| Text::ANSITable | PERLANCAR     | App-DistUtils-0.08.tar.gz                     | PERLANCAR        | App-DistUtils-0.08/bin/packlist-for                                             |
| Text::ANSITable | PERLANCAR     | Bencher-Scenario-TextTableModules-0.04.tar.gz | PERLANCAR        | Bencher-Scenario-TextTableModules-0.04/lib/Bencher/Scenario/TextTableModules.pm |
| Text::ANSITable | PERLANCAR     | Color-Theme-0.01.tar.gz                       | PERLANCAR        | Color-Theme-0.01/lib/Color/Theme.pm                                             |
| Text::ANSITable | PERLANCAR     | Color-Theme-0.01.tar.gz                       | PERLANCAR        | Color-Theme-0.01/lib/Color/Theme/Role.pm                                        |
| Text::ANSITable | PERLANCAR     | Color-Theme-0.01.tar.gz                       | PERLANCAR        | Color-Theme-0.01/lib/Color/Theme/Util.pm                                        |
| Text::ANSITable | PERLANCAR     | Complete-Module-0.24.tar.gz                   | PERLANCAR        | Complete-Module-0.24/lib/Complete/Module.pm                                     |
| Text::ANSITable | PERLANCAR     | Data-Format-Pretty-Console-0.35.tar.gz        | PERLANCAR        | Data-Format-Pretty-Console-0.35/lib/Data/Format/Pretty/Console.pm               |
| Text::ANSITable | PERLANCAR     | Dist-Util-0.06.tar.gz                         | PERLANCAR        | Dist-Util-0.06/lib/Dist/Util.pm                                                 |
| Text::ANSITable | PERLANCAR     | Dist-Zilla-Plugin-Preload-0.01.tar.gz         | PERLANCAR        | Dist-Zilla-Plugin-Preload-0.01/lib/Dist/Zilla/Plugin/Preload.pm                 |
| Text::ANSITable | PERLANCAR     | Perinci-CmdLine-1.48.tar.gz                   | PERLANCAR        | Perinci-CmdLine-1.48/lib/Perinci/CmdLine/Manual/FAQ.pod                         |
| Text::ANSITable | PERLANCAR     | Perinci-CmdLine-Any-Lumped-0.09.tar.gz        | PERLANCAR        | Perinci-CmdLine-Any-Lumped-0.09/lib/Text/ANSI/Util.pm                           |
| Text::ANSITable | PERLANCAR     | Term-Detect-Software-0.21.tar.gz              | PERLANCAR        | Term-Detect-Software-0.21/lib/Term/Detect/Software.pm                           |
| Text::ANSITable | PERLANCAR     | Text-ANSI-Util-0.21.tar.gz                    | PERLANCAR        | Text-ANSI-Util-0.21/lib/Text/ANSI/Util.pm                                       |
| Text::ANSITable | PERLANCAR     | Text-Table-Any-0.01.tar.gz                    | PERLANCAR        | Text-Table-Any-0.01/lib/Text/Table/Any.pm                                       |
| Text::ANSITable | PERLANCAR     | Text-Table-Manifold-1.00.tgz                  | RSAVAGE          | Text-Table-Manifold-1.00/lib/Text/Table/Manifold.pm                             |
| Text::ANSITable | PERLANCAR     | Tickit-Widget-Table-0.214.tar.gz              | TEAM             | Tickit-Widget-Table-0.214/lib/Tickit/Widget/Table.pm                            |
| Text::ANSITable | PERLANCAR     | Tickit-Widget-Table-0.214.tar.gz              | TEAM             | Tickit-Widget-Table-0.214/lib/Tickit/Widget/Table.pod                           |
| Text::ANSITable | PERLANCAR     | Tickit-Widget-Table-Paged-0.004.tar.gz        | TEAM             | Tickit-Widget-Table-Paged-0.004/lib/Tickit/Widget/Table/Paged.pm                |
| Text::ANSITable | PERLANCAR     | Tickit-Widget-Table-Paged-0.004.tar.gz        | TEAM             | Tickit-Widget-Table-Paged-0.004/lib/Tickit/Widget/Table/Paged.pod               |
| Text::ANSITable | PERLANCAR     | App-lcpan-0.73.tar.gz                         | PERLANCAR        | App-lcpan-0.73/bin/lcpan                                                        |
+-----------------+---------------+-----------------------------------------------+------------------+---------------------------------------------------------------------------------+

As you can see, there’s a lot of self mentions there (one of my modules/scripts mentioning my own module). To filter those out, add the option --mentioner-author-isnt. You can add more than one instance of this option.

% lcpan mentions --mentioned-module Text::ANSITable --mentioner-author-isnt PERLANCAR
+-----------------+---------------+----------------------------------------+------------------+-------------------------------------------------------------------+
| module          | module_author | release                                | mentioner_author | content_path                                                      |
+-----------------+---------------+----------------------------------------+------------------+-------------------------------------------------------------------+
| Text::ANSITable | PERLANCAR     | Text-Table-Manifold-1.00.tgz           | RSAVAGE          | Text-Table-Manifold-1.00/lib/Text/Table/Manifold.pm               |
| Text::ANSITable | PERLANCAR     | Tickit-Widget-Table-0.214.tar.gz       | TEAM             | Tickit-Widget-Table-0.214/lib/Tickit/Widget/Table.pm              |
| Text::ANSITable | PERLANCAR     | Tickit-Widget-Table-0.214.tar.gz       | TEAM             | Tickit-Widget-Table-0.214/lib/Tickit/Widget/Table.pod             |
| Text::ANSITable | PERLANCAR     | Tickit-Widget-Table-Paged-0.004.tar.gz | TEAM             | Tickit-Widget-Table-Paged-0.004/lib/Tickit/Widget/Table/Paged.pm  |
| Text::ANSITable | PERLANCAR     | Tickit-Widget-Table-Paged-0.004.tar.gz | TEAM             | Tickit-Widget-Table-Paged-0.004/lib/Tickit/Widget/Table/Paged.pod |
+-----------------+---------------+----------------------------------------+------------------+-------------------------------------------------------------------+

Top modules/scripts/authors ranked by mention count

Aside from the mentions subcommand to list individual mentions, there are also various *-by-mention-count subcommands to rank modules/scripts/authors by mention count. Some examples:

% lcpan authors-by-mod-mention-count | head -n 10
SWALTERS        49901
ETHER   9000
SUNDQUIST       4767
RJBS    4609
JRADCLIFF       3672
RIBASUSHI       3616
SHAY    3226
DROLSKY 3042
PMATTHEWS       2442
ALEXMV  2032

The number after each author is number of mentions by other authors. Whenever a module by the author gets mentioned in another module/script’s POD, it gets a count (this means, we are counting per content/mentioning POD). There are other count types that can be used for the ranking: per-dist (where each distribution that mentions a module by author is counted as one count, so an author will get a maximum of one count per mentioning dist), per-author (where an author will get a maximum of one count per mentioning author).

% lcpan authors-by-mod-mention-count --count-per dist | head -n 10
lcpan authors-by-mod-mention-count --count-per dist | head -n 10
ETHER   3535
RJBS    2296
SHAY    1643
SMUELLER        1294
DROLSKY 1111
GAAS    1076
GBARR   961
EXODIST 931
MIYAGAWA        838
DAGOLDEN        726
% lcpan authors-by-mod-mention-count --count-per author | head -n 10
ETHER   1255
RJBS    866
SMUELLER        730
SHAY    714
GAAS    601
GBARR   592
DROLSKY 543
EXODIST 470
TODDR   389
SHLOMIF 387
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s