in reply to Re: disable functions if module not installed
in thread disable functions if module not installed
require returns true on success, and string-eval eats memory :)
BEGIN { $is_magick = eval {require Image::Magick;}; } C:\>perl -e"print require CGI;" 1 C:\>perl -e"print require CGIshamalamadingdong;" Can't locate CGIshamalamadingdong.pm in @INC
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: disable functions if module not installed
by almut (Canon) on Nov 04, 2008 at 13:59 UTC |
In Section
Seekers of Perl Wisdom