I've come to similar solutions as
footpad with slight variations.
In the first case a required module isn't installed and the
script dies with a link to the dist on CPAN:
eval("use XML::Simple 'XMLin'"); # required xml parser
if($@){&install_xml_simple(); exit}
sub install_xml_simple
{
print header; print qq~Install
<a href='http://search.cpan.org/search?dist=XML-Simple'>XML::Simple</a
+>~;
}
Second case just causes some form buttons and text to not
be printed later:
my$trade = 0;
eval("use Compress::Zlib");
unless($@){$trade = 1} # if installed enable export/import
And another switch if the script doesn't find a self-created
data file:
use vars qw($xpdat1 $dat1);
my($xpdata,$data,$md,$nodat) = 0; # vars for next block
my$df = 'some.data';
if(-e $df){
if(eval "require '$df'"){
$md = (stat($df))[9];
$xpdata = $xpdat1;
$data = $dat1;
}
}
else{ $nodat = 1 }