in reply to Re^2: Post query to Metacpan API
in thread Post query to Metacpan API

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 :)