I don't believe that this is very difficult:

use warnings; use strict; use MetaCPAN::Client; my $mc = MetaCPAN::Client->new; my @modules = qw( Test::BrewBuild RPi::WiringPi Devel::Examine::Subs ); for (@modules){ printf "%s: %s\n", $_, $mc->module($_)->version; }

Output:

Test::BrewBuild: 2.20 RPi::WiringPi: 2.3628 Devel::Examine::Subs: 1.69

Here's the code broken up a bit to possibly better describe what's actually happening. The output is the same:

use warnings; use strict; use MetaCPAN::Client; my $mc = MetaCPAN::Client->new; my @modules = qw( Test::BrewBuild RPi::WiringPi Devel::Examine::Subs ); for my $module_name (@modules){ my $module_object = $mc->module($module_name); my $module_version = $module_object->version; print "$module_name: $module_version\n"; }

As I said, it may seem daunting at first, but the code will be more reliable going forward. Just takes a bit of time to read documentation, and do some basic testing :)


In reply to Re^3: Post query to Metacpan API by stevieb
in thread Post query to Metacpan API by Anonymous Monk

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.