Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
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 pondering the Monastery: (8)
As of 2014-08-22 02:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (145 votes), past polls