http://www.perlmonks.org?node_id=721240


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

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

Replies are listed 'Best First'.
Re^5: disable functions if module not installed
by almut (Canon) on Nov 03, 2008 at 23:17 UTC
    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?

      hi almut,

      It's my notebook.

      Ok after a reboot

      #!/usr/bin/perl -w use strict; use warnings; eval { require Image::Magick }; my $is_Magick = $@ ? 0 : 1; print "Content-type: text/html; charset=ISO-8859-1\n\n"; print "<h1>$is_Magick</h1>";

      works.

      Found what send me out of memory : a use lib statement ?!

      Is that expected behaviour ?

      Time to sleep.

      Thanl you all :)

      Have a nice, nice day !

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

        Hi Monks,

        going nuts !

        #!/usr/bin/perl -w use strict; use warnings; use diagnostics; eval { require Image::Magick }; my $is_Magick = $@ ? 0 : 1; print "Content-type: text/html; charset=ISO-8859-1\n\n"; print "<h1>$is_Magick</h1>";

        which finally works on my XP box, now gives me

        Deep recursion on subroutine "Image::Magick::Autoload"

        and an out of memory ! on a debian server

        has anyone a real working example ? an idea ? anything ? I cannot believe this can't be done !

        thanks

        Have a nice day !

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