lcpan tips 013: Finding modules

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.

This post is a recap of the various ways you can find CPAN modules using lcpan.

lcpan mods KEYWORD …. This can search module names and abstracts (and perhaps POD/source full-text search in the future?) For example, lcpan mods color rgb will search for modules that have “color” or “rgb” in their names/abstracts. If you only want to search in module name, use --query-type name. If you only want to search in abstract, use --query-type abstract. To search for exact module name, use --query-type exact-name. To list modules that match “color” OR “rgb” (instead of the default AND logic), add --or.

lcpan mods –author CPANID. You might also want to list modules that are published by a certain author.

lcpan mods –namespace NAMESPACE. Suitable for when you are looking for modules that are in a known namespace, for example Dist::Zilla plugins (in Dist::Zilla::Plugin namespace) or PSGI servers (in Plack::Server namespace).

lcpan related-mods. Another way of searching modules are by using the “related modules” feature. This is discussed in a previous post. For example, you are searching for HTTP clients. You can start by looking at: lcpan related-mods LWP. The downside of this method is: you won’t find obscure modules that are not mentioned by other modules/POD. Since this feature is using the mentions information to find related modules.

Leave a comment