CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Advanced: Re: [R2me2] Perl Module Deployment; what about ".pl" files?: Edit Log



1arryb
User

Jun 16, 2009, 2:43 PM


Views: 1902
Re: [R2me2] Perl Module Deployment; what about ".pl" files?

Hi R2me2,

I assume you are trying to install a Perl application that contains both scripts and modules.

I don't know if there is a "standard" way, but here is what I do:

While coding:

1. scripts go in the bin directory, modules go in the lib directory, all under the project root.

2. All scripts and modules manipulate the perl library path via Perl's 'use lib' pragma. The following boilerplate goes at the top of every .pl and .pm in your application ("myapp" in the example):

Code
my $appHome; 
BEGIN {
$appHome = $ENV{MYAPP_HOME} || "..";
}
use lib "$appHome/lib"; # Now perl can see all modules under $appHome/lib.


When installing:

1. Zip up the application directory and install it wherever you want.

2. Define MYAPP_HOME in the application user's shell environment.

3. Add $MYAPP_HOME/bin to the application user's PATH.

If the application needs to be accessible to any user logged into the machine, do 2) and 3) in the default environment scripts (or the Windows system environment control panel).

UPDATE:

I know my technique flies in the face of standard L/Unix practice where all executables go into one of several common bins, but this way is much simpler to upgrade or uninstall if you (like me) are too lazy to do the release engineering required to create a real installation package.

Cheers,

Larry


(This post was edited by 1arryb on Jun 16, 2009, 2:50 PM)


Edit Log:
Post edited by 1arryb (User) on Jun 16, 2009, 2:43 PM
Post edited by 1arryb (User) on Jun 16, 2009, 2:45 PM
Post edited by 1arryb (User) on Jun 16, 2009, 2:50 PM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives