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

Nevermind guys, I read a previous post and it helped a lot. I'm sorry for not reading it before I posted.

Now I have a new question, Does Image:Size contain C code or is it pure perl? If it is not pure perl, is there another module that is and that would return an image's demensions?

Thanks

Considered by Errto: "restore original content..." Final vote (keep/edit/delete) = 6/44/2.
Unconsidered by davido: Couldn't agree more, but the original content is unfortunately unavailable.

Replies are listed 'Best First'.
Re: installing a perl module to a website
by jZed (Prior) on Jan 15, 2005 at 20:51 UTC
    If the modules has XS components, you can't just place it in a directory, you have to install it into that directory using CPAN.pm, ppm, make, or some other method that compiles the module.

    Regardless of whether you need to compile the module, your script needs to be able to find it with "use lib". The operating environment of the webserver may be different than the shell operating environment used to install the module. You'll need to find out from your ISP what the correct path to your lib directory is in the CGI environment. You can do some experimentation by running a CGI script that prints out its current working directory and @INC and use those results to figure out where your lib directory is, but your ISP may be using symbolic links or mounts that make the @INC in your CGI different from the @INC in a script run from the shell so it's best to just find out from them how to refer to your lib directory in a script.

    update Please don't delete a posting just because you figured it out. Leave the original and add an update message so that replies to your original post make sense.

Re: installing a perl module to a website
by Errto (Vicar) on Jan 15, 2005 at 22:40 UTC
    I haven't used Image::Size, but based on a quick look at the contents of its CPAN directory, it appears not to contain any C code. However, for certain file types it requires the use of Image::Magick, which does.
Re: installing a perl module to a website
by strat (Canon) on Jan 16, 2005 at 09:03 UTC

    Btw: if you have access to a make (must be the same make perl was compiled with), but are not allowed to install modules into the normal public perl-lib-paths, you can install them into your own directory the following way (only proceed with the next command if the previous succeeded):

    # download from cpan and unpack, e.g. with tar xvzf module-1.0.tar.gz cd module-1.0.tar.gz # read README and INSTALL, if available, they will tell you # how to install the module; if the way is with make, you # can "enhance" perl Makefile.PL with PREFIX=... perl Makefile.PL PREFIX=/path/to/myhome/lib make make test make install

    Then you need to tell your scripts to use these modules, e.g. by enhancing them with:

    use lib '/path/to/myhome/lib';

    Best regards,
    perl -e "s>>*F>e=>y)\*martinF)stronat)=>print,print v8.8.8.32.11.32"

Re: installing a perl module to a website
by aquarium (Curate) on Jan 16, 2005 at 03:54 UTC
    if all you will ever want is the image size for the two leading web graphics formats (jpeg and gif), then implement the code yourself to get this info from the image file header. here's a reference page for graphic file formats.
    the hardest line to type correctly is: stty erase ^H
Re: installing a perl module to a website
by tinita (Parson) on Jan 18, 2005 at 11:58 UTC