jepri has asked for the wisdom of the Perl Monks concerning the following question:

I'm looking for a few tips on how to install my programs in the install script. I'm not looking exactly for where to put them as how to set them up.

For instance, I could just copy all the scripts and support libraries to a directory, then put a shell script in /usr/bin that looks like this

cd /usr/lib/perl_prog/ perl start.pl

At the moment I've been distributing bits of the program all over the place - the main script file in /usr/bin and then doing a use lib '/usr/lib/perl_prog/'. I've been avoiding putting my modules in the perl @INC structure because it doesn't seem quite right - the library modules aren't general purpose, so I'm just polluting the directory structure.

So how do you do it?

____________________
Jeremy
I didn't believe in evil until I dated it.

Replies are listed 'Best First'.
Re: How do you package your programs?
by lachoy (Parson) on Aug 28, 2002 at 11:45 UTC

    If you use ExtUtils::MakeMaker, you can specify a list of EXE_FILES in your Makefile.PL; they will be installed in the appropriate bin/ directory somewhere, depending on the configuration.

    For instance, in my script for OpenInteract, I have:

    my %opts = ( 'NAME' => 'OpenInteract', 'VERSION_FROM' => 'OpenInteract.pm', 'EXE_FILES' => [ qw( script/oi_manage ) ], ... ); WriteMakefile( %opts );

    This will copy the file from script/oi_manage into (on my machine) /usr/bin. You can change this (with caution) by modifying your install's Config.pm keys 'installbin', and/or 'installsitebin'.

    And there's nothing wrong with adding your library to @INC -- that's what it's for!

    Chris
    M-x auto-bs-mode

      I think it's very unfortunate that MakeMaker works this way. The directory I install the perl binary in is not the same directory I want to install a random program in, that just happens to be written in Perl.

      Large packages, I always install in /opt/app, for suitable app. This is done so you can easily remove an entire application - if only because you want to make a new, fresh, install. A program 'foo' belongs in /opt/foo/bin/foo, or /usr/local/bin/foo, depending whether I want it installed in its own directory structure or not. It should not be dropped in a directory depending on the language it happen to be written in.

      Abigail

        I second Abigail's suggestion. This also solves the problem of storing additional data files. Just use /opt/myapp/(data|sounds|grapics|...). Some applications like to install themselves as /usr/bin/myapp, then proceed to install files into /usr/share/myapp/. I prefer the first approach, as it keeps everything nicely bundled together. You can always add scripts to /usr/local/bin to put your app in the path.

        But of course, with opinions varying greatly, it is best to give the user a choice. Some might even want to install your app in a homedir on a shared server. That's the beauty of configure --prefix=/path...

      OK, but where do I put things like jpegs, sound files? That's what has slightly turned me off MakeMaker.

      ____________________
      Jeremy
      I didn't believe in evil until I dated it.