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

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Advanced:
Perl Module Deployment; what about ".pl" files?


New User

Jun 15, 2009, 11:13 AM

Post #1 of 5 (3288 views)
Perl Module Deployment; what about ".pl" files? Can't Post

Okay so I know about creating an installation of perl modules using "h2xs -X". This works fine for ".pm" module files. But what if my application also includes a "*.pl" file which needs to be located somewhere on the User's path (such as in /usr/bin ...but may vary on some linux installs). What is the standard way to create an installer that installs not only the ".pm" modules but also any needed ".pl" scripts on the users executable path ?


Jun 16, 2009, 9:43 AM

Post #2 of 5 (3283 views)
Re: [R2me2] Perl Module Deployment; what about ".pl" files? [In reply to] Can't Post

If you're using h2xs to compile your C code into perl-usable modules, then presumably, you're using MakeMaker to generate everything you need. Consider looking at CPAN for help. A cursory search found a handy module for doing anything you'd like for post (or pre) install actions:


Jun 16, 2009, 2:43 PM

Post #3 of 5 (3277 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; 
$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).


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.



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

New User

Jun 17, 2009, 10:13 AM

Post #4 of 5 (3249 views)
Re: [raxip] Perl Module Deployment; what about ".pl" files? [In reply to] Can't Post

I had done much more than a cursory search of CPAN before asking here...

This Module::Install module looks good, however the explanation/documentation is not clear enough for me. For one thing, I need to install two modules in this suite. I see an "all_from" parameter but it's not clear how to use this parameter (or some other parameter) to specify multiple perl modules (.pm) to be installed.

New User

Jun 17, 2009, 3:20 PM

Post #5 of 5 (3243 views)
Re: [R2me2] Perl Module Deployment; what about ".pl" files? [In reply to] Can't Post


I finally was able to find the answer to my own question. The answer is to add an "EXE_FILES" parameter to the WriteMakefile() call in Makefile.PL like this:

EXE_FILES => ['bin/perlscript_name_here'],

...this was for a single file. Since this is an array, multiple files are possible, of course. The perl script file itself should be located in a "bin" directory created under the directory containing the Makefile.PL.

As I mentioned previously, I looked at the documentation for "Module::Autoinstall" and even downloaded to the tarball to see if I could get my questions answered that way but to no avail. I recommend sticking with MakeMaker until documentation for "Autoinstall", written in a form that is understandable by mere mortals, becomes available.


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

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