|
From: Jamie C. <jca...@we...> - 2001-12-16 00:32:06
|
Steven Barden <st...@in...> wrote ..
> I am writing a webmin module that requires that user have loaded
>
> use strict;
> use diagnostics;
> use warnings;
> use CGI qw(:standard);
> use Archive::Tar;
> use URI::Escape;
> use bubba; # <-- fake mod to test
>
> Webmin can specify the need for other webmin modules due to dependencies
> during load, but does not seem to be able to care about required perl mods.
> Hence, use bubba fails UGLY. Is there a way to do a 'use bubba or die("you
> need to load the bubba perl module")'...? Or something like it? The
> 'require' keyword does not do it either.
One way you could do this is to have your module's index.cgi script start
with code like :
eval { use bubba; }
if ($@) {
&error("Perl module bubba is not installed");
}
You could even have the error message include a link to
/cpan/download.cgi?source=3&cpan=bubba to automatically download and
install the module from CPAN.
In the next webmin release, I will add support for a new line in the
module.info file like perldepends=bubba Archive::Tar so that these can be
caught at module install time.
- Jamie |