On Wed, Nov 05, 2003 at 07:39:37PM -0500, Dan Anderson wrote:
> How can I tell whether or not a module exists, and what
> version it is? 

There's no iron-clad rule, but the convention is for modules
to put it in the package variable $VERSION.

    sub UNIVERSAL::require {
      my ($module, $version) = @_;
      eval "require $module" or die;
      $module->VERSION($version);
    }

    CGI->require(3.00);

If the module uses Exporter -- and CGI doesn't -- then you can
also check from the command line.

    % perl -MNet::SMTP=99 -e1
    Net::SMTP version 99 required--this is only version 2.24

-- 
Steve

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to