chinaxing has asked for the wisdom of the Perl Monks concerning the following question:
Hi, everyone, I want to ensure a best method to test whether a module has loaded. if not I will load it with require;
I see some people use such method :
which use can('isa') to test . but this may not working in new version of Perl ? which will true even the $module haven't loaded;my $module = "MyModule::ABC"; eval " require $module " unless $module->can('isa');
in some situation when Module is a OO module ,which has a new method generally. we can use :
to test .$module->can('new')
is there a universal method for any module , to test loaded or not ?
very thanks your wisdom :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: module loaded test
by tobyink (Canon) on Jun 27, 2013 at 07:24 UTC | |
by Anonymous Monk on Jun 27, 2013 at 07:51 UTC | |
|
Re: module loaded test
by patcat88 (Deacon) on Jun 27, 2013 at 04:09 UTC | |
|
Re: module loaded test ( Module::Loaded)
by Anonymous Monk on Jun 27, 2013 at 04:05 UTC |