I'm trying to use CPANPLUS to query modules. Looking at the documentation, I thought the following would work:

#! /usr/local/bin/perl -wl use strict; use CPANPLUS::Backend; my $cb = CPANPLUS::Backend->new; for my $dist( @ARGV ) { my $res = $cb->search( type => 'module', allow => [], data => [qr/$dist/], ); use Data::Dumper; print Dumper($res); }

Running this with '^Text::' on the command line should spit out all the modules in the Text namespace with their current version. And then I could smoke test them. Except that it doesn't, it crashes with:

Can't locate object method "module" via package "Regexp" at /usr/local +/lib/perl5/site_perl/5.8.7/CPANPLUS/Internals/Search.pm line 166.

But... the documentation for CPANPLUS::Backend::search says:

"search" enables you to search for either module or author objects, based on their data. The "type" you can specify is any of the accessors specified in "CPANPLUS::Module::Author" or "CPANPLUS::Module". "search" will determine by the "type" you specified whether to search by author object or module object.

... and CPANPLUS::Module declares a search module accessor. 'use'ing the module explicitly in the script doesn't fix it either. Can somebody point out the error of my ways?

• another intruder with the mooring in the heart of the Perl


In reply to Using CPANPLUS::Backend to query CPAN metadata by grinder

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.