in reply to Perl modules Version Help!

To get the specific version of one module should just be a case of inspecting its $VERSION variable. Not all modules have that though, particularly the older ones (I don't know XML::DOM). Here is an example:
require CGI; print "$CGI::VERSION\n"; print "$INC{'CGI.pm'}\n";

Replies are listed 'Best First'.
Re^2: Perl modules Version Help!
by Anonymous Monk on Nov 10, 2010 at 15:27 UTC
    I am trying to use this:
    use strict; use warnings; use ExtUtils::Installed; my $instmod = ExtUtils::Installed->new(); my $module_test="CGI qw( -oldstyle_urls :standard )"; my $version = defined($instmod->version($module_test)) || "???"; print "$module_test -- $version\n";

    But if the module is not found its giving me an error:
    CGI qw( -oldstyle_urls :standard ) is not installed at modules.pl

    How can that be, shouldn't it be default to the "???" ?

      What module is CGI qw( -oldstyle_urls :standard ) supposed to be? Do you mean CGI? If so, then ask for just CGI.

        Even just for CGI its still giving me the same error, why isn't it printing the "???" if it cant find the module been passed?