FAQ Perl

From LibGD

Contents

How do I get gd to work with Perl?

The Perl libgd binding is realized through Lincoln D. Stein's great GD.pm module.

Unices/Linux

In most cases your Unix/Linux distribution contains already pre-compiled RPMs which you can easily install with your system's package manager.

Windows

If you're running ActivePerl the simplest way is to use a pre-compiled binary and install this with the ActivePerl PPM.
Here is a site which lists download locations for ready-to-install Perl 5.6.x/5.8.x binaries: http://cpan.uwinnipeg.ca/dist/GD
And another download location for Perl 5.8.x binaries: http://www.gknw.net/phpbb/viewforum.php?f=29
With PPM it is possible to directly install from the web location. For this point PPM to the GD.ppd file; f.e. from commandline this might look like:
ppm install http://www.bribes.org/perl/ppm/GD.ppd
You can also download the provided tar.gz or zip archive and install from local harddisk; for using the tar.gz you also need to download the ppd file, zip archives should contain both. This might be useful if you plan to install the GD binding on more than one system.

How do I compile the GD module from source?

In order to compile Perl modules you must have Perl itself installed on the machine you develop on.

Unices/Linux

On Unix/Linux it is normally not required to build all dependent libs self; instead it should be sufficient to just install the RPM libgd-devel with your system's package manager.
If you however need latest features or bugfixes you need to build from source - please see the C Compile FAQ for further details.
After you have downloaded the GD module from CPAN and extracted, change to the new created directory, and type:

perl Makefile.PL
make

optional you can test the just compiled stuff with:

make test

if all tests passed successfully, then finally type:

make install

that's it!

Windows

It is recommended to build all dependent libs from source - please see the C Compile FAQ for further details.
Basically the module build is very simple:

perl Makefile.PL
nmake

however due to the bunch of dependencies it might become a nightmare if you make only one typo with all the paths: then you need to start all over and enter everything again....; so I recommend to use at least a batch file to give all path parameters and options from commandline rather then entering interactive. Personally I prefer using an awk script instead; I have written one which does everything in one go:
create Makefile, create ppd file, compile, fix ppd file, create tar.gz and zip archives:
http://www.gknw.net/test/perl_gd/mkmodule.awk
in order to use this awk script you will need awk; here's a native Win32 awk (of course you can also use gawk if you have that already):
http://www.gknw.net/development/prgtools/awk-20070501.zip
and for creating the PPM tar.gz archive its recommended to use bsdtar which knows the 'z' switch:
http://www.gknw.net/development/prgtools/bsdtar.zip
for creating the zip archive you need a commandline zip which you can download from the Info-Zip home:
http://www.info-zip.org/pub/infozip/Zip.html#Win32
extract all archives to a directory in your search path so that they can be executed from commandline. Now you can try to build the GD module with:

awk -f mkmodule.awk
Views
Personal tools

This a PHP.net Project

This library was originally developed by Thomas Boutell