in reply to disable functions if module not installed
Something like this works for me:
our $is_magick; BEGIN { $is_magick = eval "require Image::Magick" ? 1 : 0; }
(my $is_magick; is fine, too, btw)
Note that the assignment in our $is_magick = 1; in your snippet would be executed after the BEGIN block... Also, the BEGIN block is only necessary if you need $is_magick's state to be valid early on.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: disable functions if module not installed
by Anonymous Monk on Nov 04, 2008 at 12:42 UTC | |
by almut (Canon) on Nov 04, 2008 at 13:59 UTC |