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.
You can install PDL from the CPAN without any manual work. However, you'll be missing a lot of goodies, like plotting, OpenGL, and the GSL. In this journal entry, I go through the steps necessary to get PDL installed and working, goodies and all.
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. If you are familiar with IDL or Matlab, think of this as Perl's extension that makes it work essentially like either of those. Having these numerical capabilities 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.
Note to ActiveState Perl users: sisyphus (one of the PDL developers/users) has created ppm packages for PDL. I have appended a comment with details, so if this is you, scroll down to the bottom of the page.
Step 0: Install Perl's OpenGL dependencies. The OpenGL module requires freeglut. If you're using Strawberry Perl 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 flavor's package manager 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, there's a PPM discussed in the comments at the bottom of this post.)
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.
(I had GSL and FFTW2 on this list, but it turns out that PDL has its own FFT implementation and does not need FFTW2, and I'm not sure that GSL should come so highly recommended. Don't get me wrong - it's a great library and I've used it before, but I think it would be more appropriate to install it only if you'll actually use it. Don't worry: if you use either of these libraries, you'll have it installed and PDL should detect it and compile the PDL bindings for it.)
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 the wiki, which not only has documentation for 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.