Hosting documentation/Scripting languages

From Bioinformatics.Org Wiki

(Difference between revisions)
Jump to: navigation, search
m (Perl)
(Added info on error reporting)
(2 intermediate revisions not shown)
Line 7: Line 7:
All driven from a variety of delicious database backends.
All driven from a variety of delicious database backends.
-
== Perl ==
+
==Perl==
 +
 
 +
===Local installation===
 +
 
Perl modules are notoriously difficult to centrally maintain on shared project servers. For this reason, and because of RedHat's slightly less than shiny reputation with managing Perl distributions, we recommend individual projects to install LOCAL copies of '''all''' Perl modules.
Perl modules are notoriously difficult to centrally maintain on shared project servers. For this reason, and because of RedHat's slightly less than shiny reputation with managing Perl distributions, we recommend individual projects to install LOCAL copies of '''all''' Perl modules.
Line 14: Line 17:
Within your project directory, you can do the following:
Within your project directory, you can do the following:
-
 
+
<source lang="bash">
-
<source lang='bash'>
+
## Step 1, install a local cpanm (and some deps)
## Step 1, install a local cpanm (and some deps)
Line 21: Line 23:
     | perl - -l local-lib App::cpanminus
     | perl - -l local-lib App::cpanminus
</source>
</source>
-
 
This pulls down cpanm from the web, and runs it though Perl with two options, 1) telling it to install '''everything''' it needs into a directory called local-lib, and 2) telling it to install itself!
This pulls down cpanm from the web, and runs it though Perl with two options, 1) telling it to install '''everything''' it needs into a directory called local-lib, and 2) telling it to install itself!
Line 27: Line 28:
If you know what you are doing, some variant of the above is all you need. But I like to have local::lib around to help set up my shell configuration:
If you know what you are doing, some variant of the above is all you need. But I like to have local::lib around to help set up my shell configuration:
-
 
+
<source lang="bash">
-
<source lang='bash'>
+
## Step 2, install local::lib
## Step 2, install local::lib
Line 34: Line 34:
     -l local-lib local::lib
     -l local-lib local::lib
</source>
</source>
-
 
If you understood step 1, this should now be clear. So...
If you understood step 1, this should now be clear. So...
-
 
+
<source lang="bash">
-
<source lang='bash'>
+
## Step 3, get local::lib to write out some handy config...
## Step 3, get local::lib to write out some handy config...
perl \
perl \
Line 45: Line 43:
     -Mlocal::lib=`pwd`/local-lib \
     -Mlocal::lib=`pwd`/local-lib \
     > local-lib.sh
     > local-lib.sh
-
 
## and don't forget to 'source' the resulting config into your shell!
## and don't forget to 'source' the resulting config into your shell!
source local-lib.sh
source local-lib.sh
</source>
</source>
-
 
Seriously, don't forget that step. Put it in your diary, put it on your wall, put it in your .bashrc.
Seriously, don't forget that step. Put it in your diary, put it on your wall, put it in your .bashrc.
Line 56: Line 52:
Finally, install any packages you need using cpanm, which is conveniently now in your path, and will conveniently use the 'local-lib' directory:
Finally, install any packages you need using cpanm, which is conveniently now in your path, and will conveniently use the 'local-lib' directory:
-
 
+
<source lang="bash">
-
<source lang='bash'>
+
## Step 4, install Foo::From::CPAN
## Step 4, install Foo::From::CPAN
cpanm Foo::From::CPAN
cpanm Foo::From::CPAN
</source>
</source>
-
 
Now if this is an Apache web-app, you'll need to put the above local-lib.sh configuration into your apache.conf ... or .htaccess ... if that is being used... SetEnv ... OK?
Now if this is an Apache web-app, you'll need to put the above local-lib.sh configuration into your apache.conf ... or .htaccess ... if that is being used... SetEnv ... OK?
-
== Python ==
+
===Error reporting===
 +
 
 +
For debugging a Perl CGI script, you should redirect the output of error messages.  Please read the following:
 +
 
 +
* [http://perldoc.perl.org/CGI/Carp.html CGI::Carp] - CGI routines for writing to the HTTPD (or other) error log
 +
 
 +
==Python==
 +
 
 +
===Error reporting===
 +
 
 +
For debugging a Python CGI script, you should redirect the output of tracebacks.  Please read the following:
 +
 
 +
* [http://docs.python.org/library/traceback.html traceback] — Print or retrieve a stack traceback
 +
 
 +
==PHP==
 +
 
 +
TBD
 +
 
 +
==See also==
-
== PHP ==
+
* [[Hosting documentation/Websites|Websites]]

Revision as of 22:43, 8 January 2012

Hosted projects can make use of a variety of scripting languages and their associated packages. For example, you can build MVC style web-applications using:

All driven from a variety of delicious database backends.

Contents

Perl

Local installation

Perl modules are notoriously difficult to centrally maintain on shared project servers. For this reason, and because of RedHat's slightly less than shiny reputation with managing Perl distributions, we recommend individual projects to install LOCAL copies of all Perl modules.

Oh no, bootstrap local-lib, you cry? Not so, it's much easier these days using mcpan.

Within your project directory, you can do the following:

## Step 1, install a local cpanm (and some deps)
 
curl -k -L http://cpanmin.us \
    | perl - -l local-lib App::cpanminus

This pulls down cpanm from the web, and runs it though Perl with two options, 1) telling it to install everything it needs into a directory called local-lib, and 2) telling it to install itself!

If you know what you are doing, some variant of the above is all you need. But I like to have local::lib around to help set up my shell configuration:

## Step 2, install local::lib
 
./local-lib/bin/cpanm \
    -l local-lib local::lib

If you understood step 1, this should now be clear. So...

## Step 3, get local::lib to write out some handy config...
perl \
    -Ilocal-lib/lib/perl5/ \
    -Mlocal::lib=`pwd`/local-lib \
    > local-lib.sh
 
## and don't forget to 'source' the resulting config into your shell!
source local-lib.sh

Seriously, don't forget that step. Put it in your diary, put it on your wall, put it in your .bashrc.

Finally, install any packages you need using cpanm, which is conveniently now in your path, and will conveniently use the 'local-lib' directory:

## Step 4, install Foo::From::CPAN
 
cpanm Foo::From::CPAN

Now if this is an Apache web-app, you'll need to put the above local-lib.sh configuration into your apache.conf ... or .htaccess ... if that is being used... SetEnv ... OK?

Error reporting

For debugging a Perl CGI script, you should redirect the output of error messages. Please read the following:

Python

Error reporting

For debugging a Python CGI script, you should redirect the output of tracebacks. Please read the following:

PHP

TBD

See also

Personal tools
Namespaces
Variants
Actions
wiki navigation
Toolbox