ChartDirector Ver 5.0 (Perl Edition)
Installation
Perl Version Compatibility
ChartDirector for Perl requires at least Perl 5.004_02, and has been tested up to Perl 5.10.0 (the latest Perl release as of the date of this document).
Note: ChartDirector for Perl on Mac OS X only supports Perl 5.6.0 or above. ChartDirector for Perl on Solaris (x86) and FreeBSD (AMD64) only supports Perl 5.8.0 or above.
Installing ChartDirector for Perl
ChartDirector for Perl is released as a zip file on Windows, and as a tar.gz file on Linux, FreeBSD, Mac OS X and Solaris. To install ChartDirector for Perl:
- Extract the files from distribution.
- On Windows, you may use Winzip or similar tools to unzip the ChartDirector distribution.
- On Linux, FreeBSD, Mac OS X and Solaris, you may use:
gunzip [chartdir_file_name].tar.gz
tar xvf [chartdir_file_name].tar
- The files for the ChartDirector for Perl module are in "ChartDirector/lib". Copy *everything* in "ChartDirector/lib" (including the fonts subdirectory in Linux, FreeBSD and Solaris versions) to a directory in your Perl module search path.
If you do not know what is the Perl module search path in your system, you may enter the following command to find out. The Perl module search path is listed as the @INC variable.
perl -V
If you could not access any of the directories in the default Perl module search path (e.g. you are using a virtual web host, and the system directories are inaccessible to you), there are a number of alternative methods to install the ChartDirector for Perl module. For example:
- Copy *everything* in "ChartDirector/lib" to the "current working directory".
- If the Perl script is running as a CGI on Apache server, the "current working directory" is the directory of the script. So you can just copy *everything* in "ChartDirector/lib" the same directory as the script.
- If you are using Perl as CGI on Microsoft IIS (or other Microsoft web servers), the "current working directory" is the directory of the web server executable, which may be inaccessible. In this case, you may use the other methods mentioned below.
- Include a
"use lib [directory];"
statement in your Perl script to add an extra directory to the Perl module search path. You may then copy all files in "ChartDirector/lib" to that directory.
In particular, for Perl CGI on Microsoft web servers, you may use the following code to include the script directory in the Perl module search path. In this case, you can copy *everything* in "ChartDirector/lib" the same directory as the script.
use File::Basename;
use lib dirname($0);
All ChartDirector sample CGI scripts contain the above two lines of code to ensure they can run on all kinds of web servers.
- Use the
"perl -I[directory]"
flag to add an extra directory to the Perl module search path when invoking the Perl interpreter. You may then copy *everything* in "ChartDirector/lib" to that directory.
Running ChartDirector Sample Programs
ChartDirector for Perl comes with numerous sample Perl scripts under the "ChartDirector/perldemo" and "ChartDirector/perldemo_cgi" directories. The former is for standalone scripts, while the latter is for CGI scripts. They are good examples and tutorials on how to use ChartDirector.
You may run these sample scripts to verify that ChartDirector is correctly installed.
To run the standalone ChartDirector sample scripts:
To run the ChartDirector sample CGI scripts:
Using ChartDirector for Perl in Your Own Scripts
Any Perl program that uses ChartDirector should include the following statement:
use perlchartdir;
Depending on how you have installed ChartDirector, you may need to copy the ChartDirector for Perl module files (*everything* in "ChartDirector/lib") to your script directory.
Installing the ChartDirector License
If you have purchased a license to use ChartDirector, you should have a license code delivered to your via email and postal mail.
If your license key is for upgrading from a previous version of ChartDirector, you need to append the upgrade license key to the previous version license key, and use the combined license key.
There are two alternative methods to install the license key.
- Create a one-line ASCII file using Notepad or other text editor, and put the license code in that line. The whole file should contain only the license code. Name that file "chartdir.lic" and put the file in the same directory as the active "libchartdir.so" (for Linux, FreeBSD, Mac OS X and Solaris) or "chartdir.dll" (for Windows), which should be in the directory where the ChartDirector for Perl module is installed or copied to.
If the license file appears to have no effect (does not disable the yellow banner line), and you are running on a web server environment, please make sure the web server "anonymous user" has read access to the "chartdir.lic" file. You may copy the file "ChartDirector/perldemo_cgi/cdinfo.pl" to your web server and access it using a browser. It will display a diagnostic page explaining why the license cannot be loaded.
Make sure your license file is called "chartdir.lic". In particular, Notepad may automatically append ".txt" to the file name when creating a new file. So even if the file is saved as "chartdir.lic", it may end up as "chartdir.lic.txt". If this is the case, please rename the file back to "chartdir.lic".
- An alternative method is to hard code the license key into the source code by using the perlchartdir::setLicenseCode API. This method is recommended if your are redistributing ChartDirector, because your customer will then be unable to see the license key (unless your software is open source).
perlchartdir::setLicenseCode(".....your-license-key.....");
© 2008 Advanced Software Engineering Limited. All rights reserved.