Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Module Version Number?

by cal (Beadle)
on Nov 02, 2002 at 04:40 UTC ( #209892=perlquestion: print w/ replies, xml ) Need Help??
cal has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks,

I am having a lot of trouble verifying which version of a module I am currently using. I would like to put some script together that gets the $version variable from the module thats in use use CGI; use GD;and then print out the version.

I see alot of command lines that do this. I dont have a telnet option and I am unable to use this technique.

Is this complex and could it work for all types of modules. Does any on have an example I could look at.

Thanks in advance

Comment on Module Version Number?
Download Code
Re: Module Version Number?
by BrowserUk (Pope) on Nov 02, 2002 at 04:55 UTC

    Just upload a short script to generate a page with the info you need something like this

    #! perl -w use CGI ':standard'; use GD; print header, html( h1( "CGI: $CGI::VERSION GD: $GD::VERSION" ) );

    Then navigate to that script using your browser and you'll see something like

    CGI: 2.752 GD: 1.27

    .
    Nah! Your thinking of Simon Templar, originally played by Roger Moore and later by Ian Ogilvy
      Works perfect
Re: Module Version Number?
by hacker (Priest) on Nov 02, 2002 at 15:42 UTC
    It took me a few minutes to get this all working right, but try this one on for size. I may put this in snippets at some point after I clean it up a bit.

    Basically it gives you a form that lists all of your modules in a dropdown box, you pick the module, click "Module details", and it will show you module name, version, and files contained within it, including full path to those files. It also links the module name to the appropriate CPAN module search, so you can find the documentation on it, and read up on how to use it.

    Short and sweet.

    Update: I turned this into a Snippet and added a bunch of new features, which you can find over here: MoDetails v0.2

    #!/usr/bin/perl use strict; use CGI qw(:standard); 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(); 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(font({-face=>'courier'}, b("Module"), ":", a({-href=>"${cpan}?query=$module&mode=module"}, "cpan://$module"))); print p(font({-face=>'courier'}, b("Version"), ":", $inst->version($module))); push my @filelist, $inst->files($module); print p(font({-face=>'courier'}, b("Files"), ":", br(), join br(), $inst->files($module))); } print end_html();
      Very Cool.. hacker

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://209892]
Approved by SparkeyG
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (7)
As of 2014-09-02 09:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (20 votes), past polls