in reply to checking for preloaded modules
So you could do:> perl print "Data::Dumper exists\n" if %Data::Dumper::; > perl -MData::Dumper print "Data::Dumper exists\n" if %Data::Dumper::; Data::Dumper exists
Keep in mind, however, there is a caveat to that: if you load HTML::Template::othermodule without loading HTML::Template, that may fail. Instead, you can do:if (%HTML::Template::) { # HTML::template stuff } else { # Regular HTML stuff }
which checks for the existance of the import subroutine. import is in every package by default, and that can be used to see if it exists (and hence if a module has been loaded by that name).if (exists ${%HTML::Template::}{'import'}) { ... }
|
|---|