Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
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

Replies are listed 'Best First'.
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?
[RonW]: Tunnel FTP through stunnel?
[james28909]: i guess i should have done it in perl. i bet it woulnt have taken me 5 hours to figure out haha
[choroba]: In the end, I was able to upgrade Perl from 5.8.3 to 5.22 and install Net::SFTP::Foreign , at least for the task involved
[james28909]: what would be the best way to capture that stream with perl? ffmpeg args -rtp rtp://127.0.0.1?
[LanX]: if I was forced to talk about all security risks I encountered oO
[james28909]: if i did that with ffmpeg, i could then listen on the port with perl right?
[LanX]: one of my clients filtered a menu linking to Web pages according to user rights. .. but he didn't secure the access to those unlisted pages

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (11)
As of 2017-05-22 21:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?