CIPRES Perl Demo

This is a perl script that shows how to use the CIPRES REST API to submit jobs and retrieve results.

I. Installation
II. How to Use


IMPORTANT

Before starting the demo, follow the registration instructions in the CIPRES REST API User Guide to create an account for yourself, login and register an application. Make note of the application ID that is assigned.


I. Installation

  1. The demo requires libwww-perl. Please make sure it's installed.
  2. If you're reading this on your computer, you have probably already downloaded the demo code and documentation, but if not, get it now by following the instructions in the Sample Code section of the User Guide. Once you've retrieved all the examples, you'll find this perl example in the "perl_demo" directory.
  3. Put your username, password, application name and application ID in the supplied pycipres.conf file.
  4. Copy pycipres.conf to your home directory. (Alternatively, put pycipres.conf anywhere you want and set the environment variable PYCIPRES to the full, absolute pathname of the file).
Platform specific notes follow:

Windows:

The demo runs on windows under Cygwin. If using Windows, install Cygwin. Run the appropriate installer, and choose the packages to install. The package that this demo uses is called LWP (Library for WWW in Perl). Thus, you should make sure that along with all the other Perl packages (which are necesary for compilation and execution of Perl scripts), these three LWP packages are installed as well: perl-LWP: Perl WWW Modules, perl-LWP-Media Types: MME type detection module for Perl, and perl-LWP-Protocol-https: :UserAgent.

Mac:

You may encounter difficulties with certificate authority validation. To fix this, you can use the LWP library version 6.00 or above. Or look into Net::SSL and how to set the environment variables HTTPS_CA_DIR and HTPPS_CA_FILE. Otherwise, you can take the simple but insecure route that we have used in the demo by putting the following bit of code: $browser->ssl_opts(verify_hostname => 0); prior to the code that sets the user's credentials: $browser->credentials(..)

Linux:

Use apt-get or cpan to install libwww-perl if it isn't already installed.



II. How to Use

Go to the "Code" directory containing "cipres_perl.pl" and run "perl cipres_perl.pl"

The output should look like:

Now checking the directory /Users/anthony/cipres_data/sdk_versions/testdata/pycipres.conf for pycipres.conf 
Now checking the directory /Users/anthony/pycipres.conf for pycipres.conf 
Now checking the directory  for pycipres.conf 
Hostname: www.phylo.org
What would you like to do? Valid commands are: 
List Jobs (LJ); Submit Job (S); Delete Job (D); List Results (LR); 
Download Results (DR); Get Tools (GT); Exit (E) 
		
If the login credentials or application ID you supplied in pycipres.conf aren't correct, then when you issue a command that authenticates with the REST API (for example, if you type "LJ" to list your jobs), the demo will prompt you to enter valid credentials.
Author:
Anthony Lopez
CIPRES REST Services