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

Hello Monks,

Any ideas about this error.


Software error: Can't locate object method "newFromJpeg" via package "GD::Image" at /u/web/dom/cgi-local/thumbnail.cgi line 47.


using Perl Version 5.006 , GD version 1.32 and says it requires perl version 5.004

The GD.pm module is located in my local cgi-local bin not the main perl library using this code.

unshift @INC, '/u/web/dom/cgi-local';

looks like IRIX for UNIX

u/sybase/OpenClient/IRIX64/1250/OCS/bin:/u/sybase/OpenClient/IRIX64/12 +50/OCS/install:/u/sybase/OpenClient/IRIX64/1111/bin:/u/sybase/OpenCli +ent/IRIX64/1111/install:/u/sybase/OpenClient/IRIX64/1004/bin:/u/sybas +e/OpenClient/IRIX64/1004/install:/bin:/sbin:/usr/sbin:/usr/bsd:/usr/b +in:/u/httpd/bin:/usr/local/msql/bin:/u/bin:/usr/local/bin:/usr/etc:/u +/qmail/bin

edit (broquaint): added <code> tags

Replies are listed 'Best First'.
Re: Can't locate object method
by fglock (Vicar) on Nov 01, 2002 at 17:49 UTC

    Try: use lib qw(/u/web/dom/cgi-local);

    update: also, check that your Image.pm file is under /u/web/dom/cgi-local/GD/

    update: (just checked) GD::Image is included inside the GD package.
    Did you install GD using "make" (Linux) or "ppm" (under Windows)? Because it won't work if you just copy it to your directory.

      Thanks,
      I presume you meant instead of
      unshift @INC, '/u/web/dom/cgi-local';
      No change
      Cal
      Thanks ,

      What is ppm(under windows)?

      Do you mean GD wont work if I copy just the GD.pm module to my cgi-local directory?

      Providing I have the file to install. I think your saying I would have to install this from a command line. I dont have access to telnet on this account.

        cal,

        PPM is the Perl Package Manager, written by the good people at ActiveState. It is a simple interactive shell environment where you can download and install Perl modules, and the pre-complied binary components (if required). Though you can use the tool with any version of Perl on any platform in theory, in practive it's only any use if you use an ActiveState built version of Perl (Solaris, Linux or Win32). I don't know if anyone on Solaris or Linux uses it, but for Windows it's the normal way of installing a module, especially if it inculdes a non Perl binary component.

        Perl modules can be split into two basic types, pure Perl and Perl + something else (hybrid). If a module is pure Perl then you can download it from CPAN and install it with the normal build process, all you need is make, you don't need any other tools. If it contains something else, then you will need the tools to build and link that something else. Normally Unix and Unix like system have all the tools, but Windows systems do not, hence PPM's popularity on Windows.

        GD is not a pure Perl module, it needs to access a graphics library that is written in c. So to install GD you need to install the library first.

        Pure perl modules if properly written are totally cross platform, so you can copy them from one kind of computer to another, or even install by hand with pretty much no problems at all. You can usually even get away with moving them between different versions of Perl too - they are pretty robust oveall.

        Hybrid modules can't be moved about. You can't copy the binary file from one Perl module on one kind of computer to a different kind of computer. You can't always copy a binary file even from computer to computer, even if they are running the same operating system on the same CPU, because there are subtle differences between the machines.

        Sorry this is a bit complex....

        In summary, if it's a pure-Perl module then you can copy it from where you installed it one one computer to another computer and it should run okay. If it's a hybrid module, then you may have to install a library first, you will probably need acces to a compiler to build the module, and you shouldn't copy the module from one computer to another - bad things could happen......

        In your case your best bet is to ask the admin of the server to install the module for you - it will benefit everyone else on the machine anyway.....

        Some other useful links:

        Good luck!


        --
        ajt
      Hello,

      I had no idea that GD used Image.pm . Is that writen by Lincoln Stein. Is it a standard module to used with GD. Where can I get it?

      Thanks for your help

      Cal