

PGPLOT module for Perl
----------------------

Karl Glazebrook

karl_pgplot@mac.com

Last update to this file: Jan 3rd 2006

[see file CHANGES for new features]

This module allows the use of the the PGPLOT graphics library from the
popular Perl scripting language. PGPLOT makes it very easy to process
and plot data using the powerful file and text manipulation facilites
built in to Perl.  Perl provides a superset of the features of the
useful UNIX utilities awk and sed and is the `Swiss-Army Chainsaw' of
UNIX programming.

Because Perl is a scripting language a program can be changed and rerun
to instantly see the effect on a plot.  This makes program development
a lot faster and much more fun than when using PGPLOT from fully
compiled languages such as C or FORTRAN. Users of MONGO and SM will be
familiar with this style of programming. Perl also allows you to create
advanced World Wide Web page features and/or routinely do system
management tasks (Perl handles regular expressions, files and sockets
with equal ease).

PGPLOT is a very popular library for plotting astronomical data. (As a
glance through any issue of ApJ or MNRAS will confirm.) I have always
found that with PGPLOT I could produced far nicer and more complex
plots than I could with MONGO but it was always harder to use because
it had to be done from C or FORTRAN. SM is a nice package, but the
language is primitive in comparison with Perl and it is not free
software.

The PGPLOT module for Perl is free software and provides a complete
Perl interface to all of the PGPLOT library functions. The current
module version is 2.0, it requires Perl 5.003 (or greater) and builds
against the 5.2.0 version of the PGPLOT C/FORTRAN library.

The core module is available from The Comprehensive Perl Archive 
(CPAN) network in the directory 

http://search.cpan.org/search%3fmodule=PGPLOT

Installation
------------

1) First you must compile and install the pgplot graphics libraries:

   The source can be obtained from the ftp site astro.caltech.edu
   in directory /pub/pgplot. Alternatively see the home ftp sites
   above. To build pgplot you need a FORTRAN compiler - the free
   compiler GNU-77 works just fine (versions 5.0-18 and above). There
   is a PGPLOT Home Page at: http://astro.caltech.edu/~tjp/pgplot/

2) Download and unpack the module. Then follow the standard Perl build
   procedure:

   perl Makefile.PL
   
   If you want to install somewhere other than the standard perl 
   location (e.g. in your home directory) replace this line with
   something like:
   
   perl Makefile.PL PREFIX=/home/me
   
   make
   make test

   [When you run 'make test' you will be prompted for a graphics device.
    Try /XSERVE for a X11 display.]

   If something goes wrong read the file HELP, if everything works:

   make install
   
   If you want to install in the standard perl location you will need to 
   do this as root.
   
   If you used PREFIX above the files will install themselves
   in /home/me/lib/perl5/site_perl/...
   
   Then to use them you will need to set the environment variable PERL5LIB 
   to point to this, e.g. for csh users:
   
   setenv PERL5LIB /home/me/lib/perl5/site_perl
   

Problems
--------

See the file HELP

