Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks!
I have a program that needs the Perl Module Image::Magick to run. After talking to the help desk at my ISP, I was told that the particular module is installed on the server.
But I am still getting this error message:
Software error: Can't locate Image/Magick.pm in @INC (@INC contains: /usr/ports/graphi +cs/ImageMagick/ /usr/local/lib/perl5/5.8.3/i386-freebsd /usr/local/li +b/perl5/5.8.3 /usr/local/lib/perl5/site_perl/5.8.3/i386-freebsd /usr/ +local/lib/perl5/site_perl/5.8.3 /usr/local/lib/perl5/site_perl .) at +test.pl line 9. BEGIN failed--compilation aborted at test.pl line 9.


And here is the code I am using just to test if this module is actually installed:
#!/usr/bin/perl use CGI(-debug); use strict; use CGI::Carp qw(fatalsToBrowser); #Location where they told me that this module has been installed use lib "/usr/ports/graphics/ImageMagick/"; use Image::Magick; print "Content-type:text/html\n\n"; print "test";


My question is to know what or where the problem is because I can't see it anymore.
Any Help Please!

Replies are listed 'Best First'.
Re: Perl ImageMagick
by gellyfish (Monsignor) on May 23, 2006 at 16:14 UTC

    /usr/ports/graphics/ImageMagick looks suspiciously like the location in the FreeBSD ports collection that you would find ImageMagick and not the location it has been installed at all. You would cd to this directory and run make install to install ImageMagick. If ImageMagick was installed from ports on FreeBSD it would be in the same place as the other libraries and you wouldn't need to specify a different location using use lib

    So I don't think they have installed it at all.

    /J\

Re: Perl ImageMagick
by blazar (Canon) on May 23, 2006 at 16:20 UTC
    #!/usr/bin/perl

    -T?

    use CGI(-debug);

    I think this is syntactically correct, but I'm not really sure how it will be interpreted. I guess you may want

    use CGI qw(-debug);

    instead.

    use strict;

    Fine. How 'bout warnings too?

    use CGI::Carp qw(fatalsToBrowser); #Location where they told me that this module has been installed use lib "/usr/ports/graphics/ImageMagick/";

    Wild guess: I cannot say for sure, but IIRC /usr/ports/ is the directory in which some *bsd osen (e.g. OpenBSD) put their package collections. But AIUI it's not the location for perl modules or program executables nor support stuff. So chances are that they incorrectly pointed you to the ports tree location of the ImageMagick suite rather than to that of Image::Magick.

    print "Content-type:text/html\n\n";

    Don't, especially since you're correctly using CGI.pm anyway...

      The bottom line is that they probably have it in a wrong place or not well installed.
Re: Perl ImageMagick
by leocharre (Priest) on May 23, 2006 at 17:19 UTC

    If you have shell access do this:
    locate Magick.pm
    You'll get output of where it is. - likely. This may spit something out like /usr/lib/wrongplace/Image/Magick.pm Then add to your script:

    #!/usr/bin/perl -wT use strict; use lib '/usr/lib/wrongplace'; use Image::Magick;

    That may work.
    You shouldn't *have* to do that.. It should be in the right place. but.. it's quicker then waiting for some wanker with root access to fix it. Use another ISP. Maybe?

      Unfortunately I don't have root access into my account, but I am about to take the other option, going for another ISP.
        #!/usr/bin/perl use strict; use warnings; print "Content-type: text\/plain\n\n"; `locate ImageMagick`;

        Save that as a CGI in your account space, hit the appropriate URL, see what it says. Or go whole hog and install perldiver.