in reply to Re: Perl modules Version Help!
in thread Perl modules Version Help!

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 "???" ?

Replies are listed 'Best First'.
Re^3: Perl modules Version Help!
by Corion (Patriarch) on Nov 10, 2010 at 15:29 UTC

    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?

        Where in the ExtUtils::Installed documentation did you find your usage documented?

        If you start reading the documentation, you'll find that your usage is not documented and, latest by looking at the source code, you will find that calling ->version for a module that is not installed is fatal.

        I recommend that you stick to the documentation and the documented usage instead.