Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

How does @INC get set?

by Bone_Scavenger (Novice)
on Nov 10, 2004 at 16:19 UTC ( #406706=perlquestion: print w/replies, xml ) Need Help??
Bone_Scavenger has asked for the wisdom of the Perl Monks concerning the following question:

I'm wondering how all the paths I see in my @INC get set. Here's the problem I'm having. I have a site hosted at Canaca. I've installed Movable-Type on my site, and I run the Movable-Type cgi script that checks for the presence of various pieces of software. One of the perl modules that it looks for is Image::Majick. According to my host, Image::Majick is installed on my server. According to the Movable-Type cgi script, it's not there. I'm guessing that's because the path to Image::Majick isn't in my @INC.

I've exchanged numerous emails with my host on this subject. They've given me a few paths to try to resolve the problem. I've used the "-I" perl command-line flag to specify the paths but it still doesn't work.

My thinking is that the host should be controlling the inital setup of my @INC. I shouldn't have to change the value of @INC in every cgi script that needs access to Image::Majick.

So, I'm wondering what I need to have the host do so that my server has the Image::Majick directory specified in @INC.


Replies are listed 'Best First'.
Re: How does @INC get set?
by fglock (Vicar) on Nov 10, 2004 at 16:56 UTC

    Please check that you are not mistyping the module name - Image::Magick

      Sorry, I mis-spelled it in this thread. The cgi script that is looking for the Image::Magick module spelled it correctly.

      Is PerlMagick also needed for Image::Magick? The exact message I get when I run the cgi script is:

      Your server does not have Image::Magick installed, or Image::Magick re +quires another module that is not installed.
      So, if PerlMagick is a required module of Image::Magick, then that might explain it.

        You could try to figure out if it is Image::Magick that is missing, or if it is some dependency. "PerlMagic" was the parent-poster's way of pointing out that there is a library called "ImageMagick", but that it is separate from the Perl module "Image::Magick".

        You might try this quickie script to dump the actual error to your browser:

        #!/usr/bin/perl BEGIN { require POSIX; local $SIG{__DIE__} = sub { print "Content-type: text/plain\n\n@_"; POSIX::_exit(0); #Needed to prevent HTTP/500 Error }; require Image::Magick; Image::Magick->import(); }

        That should result in a message that looks something like

        Can't locate Image/ in @INC (@INC contains: C:\Perl\lib\ C:/Perl/lib C:/Perl/site/lib .) at line 1.

        Appearring in your browser. It should give you some idea if Image::Magick is missing (like in the message above), or if one of its dependencies is gone.

        require General::Disclaimer;
        Perl is

Re: How does @INC get set?
by ikegami (Pope) on Nov 10, 2004 at 16:33 UTC
    It's hardcoded, but you can add to it by using the environment variable PERL5LIB or using use lib 'path' in your code, among other ways.
      Is it reasonable to expect the host to take care of those sorts of details? When they add a new perl module to their systems, it should be automatically reflected in everyone's web server (if that's their intention). They shouldn't be sending me the path, as if I knew what to do with it. I've got lots of computer experience (DBA mostly), but very little Perl and no web server experience. I can't imagine the frustration some non-techie would have.

      So, the key is to ask my host to add the Image::Majick path to the PERL5LIB variable?

      I guess I could change hosts, but that would be an inconvenience.

        Yes, it is reasonable to expect the host to take care of those sorts of details. In fact, it should be installed into somewhere in @INC by default. Are you sure it's installed? Maybe they installed ImageMagick and not PerlMagick (Image::Magick)?

        Update: Like fglock noticed, you're mispelling Image::Magick.

Re: How does @INC get set?
by johnnywang (Priest) on Nov 10, 2004 at 18:48 UTC
Re: How does @INC get set?
by buttroast (Scribe) on Nov 10, 2004 at 19:09 UTC
    You are referring to Image::Magick, correct?
    Thanks buttroast
      Yes, Image::Magick.
Re: How does @INC get set?
by steves (Curate) on Nov 12, 2004 at 14:18 UTC

    On *nix systems where I use Image::Magick I also have to set LD_LIBRARY_PATH or the equivalent so the run-time ImageMagick libraries can be found. It's a longshot, but maybe worth investigating. It might also help to join one or more of the ImageMagick mailing lists. I've been on those and the people are generally very responsive and helpful.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://406706]
Approved by sschneid
[hippo]: It's documented in the synopsis of perlsub anyway.

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (10)
As of 2018-05-22 10:25 GMT
Find Nodes?
    Voting Booth?