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

Re^2: disable functions if module not installed

by lepetitalbert (Monsignor)
on Nov 03, 2008 at 22:40 UTC ( #721233=note: print w/ replies, xml ) Need Help??


in reply to Re: disable functions if module not installed
in thread disable functions if module not installed

Hi almut and pileofrogs,

almut your code gave me an out of memory too.

pileofrogs fatalstobrowser is on. An example of one of these block eval's ?

Thank you.

"There is only one good, namely knowledge, and only one evil, namely ignorance." Socrates


Comment on Re^2: disable functions if module not installed
Re^3: disable functions if module not installed
by pileofrogs (Priest) on Nov 03, 2008 at 22:50 UTC

    Read up on eval in [perlfunc].

    Short answer:

    Block

    eval { die "You commie!" };

    String

    my $death = 'die'; eval "$death \"You commie!\";"
Re^3: disable functions if module not installed
by almut (Canon) on Nov 03, 2008 at 22:51 UTC
    almut your code gave me an out of memory too.

    Weird.  Can you just plain load the module with use Image::Magick; (or require Image::Magick;)?  In case the machine (or user limit) doesn't provide sufficient memory to load the module (which in theory could be possible), I'd expect that you get "out of memory" either way.

    An example of one of these block eval's ?
    eval { require Image::Magick }; my $is_magick = $@ ? 0 : 1;

      Hi again

      use Image::Magick; works like a charm, am using it for weeks.

      eval { require Image::Magick }; my $is_Magick = $@ ? 0 : 1;

      produces out of memory too :(

      I have : XP, 2Gb ram, perl 5.10, IM 6.4.4-2, PerlMagick installed with IM installer

      Thanls again.

      "There is only one good, namely knowledge, and only one evil, namely ignorance." Socrates
        produces out of memory too

        This doesn't make much sense, as the eval { ... } is essentially also just loading the module (or trying to), only with fatal errors trapped.

        I have : XP, 2Gb ram, perl 5.10, IM 6.4.4-2, PerlMagick

        This is your web server machine, is it?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://721233]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2014-07-26 00:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (175 votes), past polls