
1arryb
User
Jun 16, 2009, 2:43 PM
Post #3 of 5
(2957 views)
|
Re: [R2me2] Perl Module Deployment; what about ".pl" files?
[In reply to]
|
Can't Post
|
|
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):
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)
|