Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

disable functions if module not installed

by lepetitalbert (Abbot)
on Nov 03, 2008 at 21:21 UTC ( [id://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
Domain Nodelet?
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?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (4)
As of 2024-04-26 01:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found