david m writes "Chris Marshall has recently released PDL v2.4.5, a stepping-stone in the
Perl Data Language. Chris has led the charge to get cross-platform OpenGL
support for PDL. In the past, PDL has used its own GL code, but with Chris's
work it now uses Perl's Open GL module, affectionately known as POGL.
In this journal
entry, I go through the steps necessary to get PDL installed and working.
The Perl Data Language is a language extension that adds number-crunching and
numerical array capabilities to Perl that is on par with C in terms of speed
and memory consumption. This is good, but the
project is quite complicated and some manual work is probably necessary to get
PDL to work the way you'd like. That's what I'll discuss here. I will
perform this tutorial using my cpan shell, but hopefully the instrucitons I
give will be decent enough that you can perform the installation manually if
you cannot use cpan.
Step 0: Install Perl's OpenGL dependencies. The OpenGL module requires
freeglut. If you're on Windows, you don't have to do this because POGL (Perl's
OpenGL) will download everything it needs. If you're on Linux, you'll need to
check your package database for it's library or
get it from Sourceforge.
Step 1: Install Perl's
OpenGL module. You should be
able to get this on cpan without trouble by issuing:
If you run into trouble, look at the INSTALL file by typing
in cpan and then examining the file. Hopefully a few manually issued commands
will solve your problem.
If you don't use cpan, you can still
get the tarball from cpan's web page.
If you download the tarball, you'll need to unpack it somewhere, open a command
prompt in the unpacked directory, and issue the following commands:
The last command will probably have to be run with root privileges.
Note that on some platforms, you may need to replace
a similarly named utility. I believe it's
dmake for Strawberry
Perl. If it's not, you probably know who you are and what it's called. I'm
sure Google can help. (If you've got ActiveState's Perl, I believe you'll just
have to wait for ActiveState to package PDL for you. Can anybody suggest a
Step 2: Check out the new PDL code (but don't install yet!). From the
cpan shell, simply type
get PDL. If cpan is not available to you, you
can download the source code from
cpan's web page for PDL
or from sourceforge.
Either way, you'll get a tarball that you'll have to open up somewhere.
Step 3: Take care of the prerequisites. As long as you've got a C compiler, PDL
should work out-of-the-box. However, you can enable a great deal of optional
functionality by ensuring you've got a few dependencies installed. To figure
out what these dependencies are, go to the directory containing the (untarred)
distribution (in cpan, you do that by typing
look PDL) and examine the
DEPENDENCIES file. Make a list of the various dependencies that you'll have
to install. I recommend installing these before you install PDL.
Here's an overview of the dependencies that I deem important. To read about
all of the dependencies, check out the DEPENDENCIES file. If you have any
questions about dependencies I don't discuss here (or about stuff I do discuss
here, for that matter), you can send a query to the PDL mailing list, which
you can find here.
- Makes your PDL shell a more pleasant experience
- Already discussed - needed for OpenGL stuff
- This is useful for 2D plotting (which I hope to
write about some time in the not-so-distant future). You'll need
the PLplot libraries, which you can hopefully install for your
system with your package manager; otherwise you can
get them from sourceforge.
- The GNU Scientific Library contains all sorts of useful
stuff. I'm not entirely sure what how much is bound to PDL, but
chances are good that if you do any scientific computing, you'll
- If you ever take Fourier transforms (which is easy
to do in PDL, by the way) you'll need a copy of this library.
Remember: PDL has many other optional features that have their own
prerequisites, such as SLATEC and Minuit. Please check the DEPENDENCIES file
for details on what's available and what it requires.
Step 4: Install PDL. Now that you've got all the prerequisites out
of the way, go ahead and install PDL. You can use the same commands you used
when you installed POGL above. If you run into trouble here, take a look at
perldl.conf file, which will allow you to tweak the
installation process a bit more to your liking.
The build process can take a while, but you'll want to pay attention. The
process automatically detects various libraries. This is particularly important
if it misses an important library for you, in which case you will
probably need to tweak the
perldl.conf file. The file has lots
of internal self-documentation so hopefully you'll be able to figure out what
to try to fix your problem. However, if you run into trouble, check out the
BUGS file for instructions on how to report bugs or other trouble to the PDL
Step 5: Learn more about PDL. The documentation for PDL isn't great
for beginners, but it gets the job done. Check out
wiki, which not only has documentation fo PDL but also has links
to some good external documentation. If you find some feature to be somewhat
under-documented, please let me know and I'll try to tackle it some time in
one of my journals. Then, hopefully, I'll propagate the documentation back
to the wiki and the POD files.
I hope this helps those of you who have been curious about PDL but have not
put in the effort to get it to work. If you have any questions, the readers
of the PDL mailing list are usually happy to help. Check
here for those email addresses.