Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

disable functions if module not installed

by lepetitalbert (Monsignor)
on Nov 03, 2008 at 21:21 UTC ( #721195=perlquestion: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    $is_magick = 0;
    
    if ( is_installed Image::Magick ) { $is_magick = 1 }
    
  2. or download this
    if ( $is_magick = 0 ) {
    
    ...
    
      do stuff with Image::Magick ...
    }
    
  3. or download this
    our $is_magick = 0;
    eval 'require GD';
    ...
      # we have GD, go for it!
      $is_magick = 1;
    }
    
  4. or download this
    our $is_magick = 1;
    BEGIN {
    ...
        $is_magick = 0;
      }
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://721195]
Approved by Limbic~Region
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2014-09-20 04:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (152 votes), past polls