Search code examples
perlcpan

searching cpan.org from the commandline


I'm wondering if there's a feature to CPAN that allows the user to search all the modules available at CPAN.org.

I could probably just write something that sends the get request and spits back the answers...just wondering if there is already a built in utility...it would be really great.

I like how in debian or ubuntu linux, there is this thing "apt-cache search", or "aptitude search", that shows you which packages are already installed, and which packages are potentially available for you system. It would be a really great thing if there was something like this for perl modules/CPAN.


Solution

  • You can run Perl's CPAN module interactively:

    # perl -MCPAN -e shell
    Terminal does not support AddHistory.
    
    cpan shell -- CPAN exploration and modules installation (v1.9800)
    Enter 'h' for help.
    
    cpan[1]> i /JSON::XS/
    Reading '/home/alt/.cpan/Metadata'
      Database was generated on Wed, 06 Mar 2013 23:07:32 GMT
    Module  < Catalyst::Action::Deserialize::JSON::XS (BOBTFISH/Catalyst-Action-REST-1.06.tar.gz)
    Module  < Catalyst::Action::Serialize::JSON::XS (BOBTFISH/Catalyst-Action-REST-1.06.tar.gz)
    Module  < JSON::XS               (MLEHMANN/JSON-XS-2.33.tar.gz)
    Module  < JSON::XS::Boolean      (MLEHMANN/JSON-XS-2.33.tar.gz)
    Module  < JSON::XS::VersionOneAndTwo (LBROCARD/JSON-XS-VersionOneAndTwo-0.31.tar.gz)
    Module  < Mojo::JSON::XS         (YSYROTA/Mojo-JSON-Any-0.990104.tar.gz)
    Module  < Mojo::JSON::XS::_Bool  (VTI/Mojo-JSON-Any-0.990103.tar.gz)
    Module  < Sledge::Plugin::JSON::XS (TOKUHIROM/Sledge-Plugin-JSON-XS-0.05.tar.gz)
    8 items found