perl.org wrote:
I want my code to call some subroutines in a custom module only if that module exists on the system. I can think of at least three techniques to determine if the module exists: scan @INC, use UNIVERSAL::can (not sure that would work), or put the code in an eval block. What is the best solution? I think an eval block sounds right, but I'm not sure. My guess would look something like:
eval { use module; module::subroutine(); };
I know of a module that is almost done with that has a function called
gotmodule()
if( gotmodule('Foo::Bar') ) { print "Foo::Bar is version $Foo::Bar::VERSION\n"; } else { print "You should install Foo::Bar it is pretty nice\n"; }
If you're insterested I can let you know when it is done... (I'm tracking it for the Author..)
Lee.M - JupiterHost.Net
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>