After reading a question on this node about querying installed module versions without having an interactive shell account on the box, I decided to hack up a quick CGI that does what the monk asked, and also adds a bit of additional functionality that could be helpful to others as well.

This module will query your locally installed modules using ExtUtils::Installed, present them in a standard dropdown form using CGI, and when you select a module by name from the list and click "Module Details", it will display the module name, version number, and the files associated with that module, including the full path to them on the system. Additionally, it will link the module name to a CPAN search for that module, so you can read up on the docs for it. Originally, I was going to use File::Basename and run pod2html against $base, and display that, but I figured CPAN's module documentation would be more current, and probably more useful.

It was a quick hack, let me know what you think!

ChangeLog

v0.2
A few small updates, as requested by some monks.

v0.1
Initial release

#!/usr/bin/perl use strict; use CGI qw(:standard); use File::Basename; use ExtUtils::Installed; my $script = $ENV{'SCRIPT_NAME'}; my $cpan = "http://search.cpan.org/search"; my $inst = ExtUtils::Installed->new(); my $cgi = CGI->new(); print header(), start_html({-style =>'font-family: courier;', -title =>'MoDetails v0.2'}); print_form(); print_results($cgi) if $cgi->param('mod'); sub print_form { push my @modules, $inst->modules(); my $modname = $cgi->param('mod'); print start_form(-name =>"modules", -action =>"$script?mod=$modname"), popup_menu(-name =>'mod', -value =>\@modules), submit(-label =>'Module Details'), end_form; } sub print_results { my $module = $cgi->param('mod'); print p({-class=>'c'}, b("Module Name"), ":", $module); print p(b("Version currently installed"), ":", $inst->version($module)); push my @filelist, $inst->files($module); print p(b("Files Installed by $module"), br(), join br(), $inst->files($module)); push my @podpm, $inst->files($module); foreach my $file (@podpm) { my $base = basename($file); my $dir = dirname($file); my $nmod = $module; $nmod =~ s,::,/,; if ($file =~ /$nmod.pm/i) { system('/usr/bin/pod2html', "$file", '--outfile', "$base.html"); print b("Documentation for"), ":", br(), a({-href=>"$base.html"}, "$module.pm"), " (local version)", br(); } } print a({-href=>"${cpan}?query=$module&mode=module"}, "$module"), " (CPAN latest version)", br(); my @newinc = (split " ", "@INC"); print br(), b("Environment available to this user"), br(), "\@INC", div({-style=>'padding-left: 20px;'}, join br(), sort @newinc); print br(), b("Host operating system"), br(), div({-style=>'padding-left: 20px;'}, "$^O"); print br(), b("Path to perl binary"), br(), div({-style=>'padding-left: 20px;'}, "$^X"); }

In reply to MoDetails v0.2 by hacker

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.