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

Geetings to the perl monks full of wisdom!

I need to write an installation script and search for modules and examples how to do this. It needs to download modules and install them and perhaps provide a nice interface.

Anyone any expireience with than and can help?

----
NaSe
:x

  • Comment on writing a nice installation program/script

Replies are listed 'Best First'.
Re: writing a nice installation program/script
by PodMaster (Abbot) on Jul 30, 2002 at 08:46 UTC
    It really depends on your target os.

    Take a look at the PPM (distributed with ActivePerl) and the CPAN (distributed with perl) and CPANPLUS (available from cpan) modules.

    You also might wanna look in the Term or Curses family for an interface.

    Generally such scripts rarely work out nicely due to the unlimited number of problems that can crop up.

    ____________________________________________________
    ** The Third rule of perl club is a statement of fact: pod is sexy.

Re: writing a nice installation program/script
by CubicSpline (Friar) on Jul 30, 2002 at 12:58 UTC
    Most of my perl is written under Windows using ActiveState and I've written my share of installation scripts with it. The first thing I would suggest is that you download all of the modules that you need and package them up with your installation script (do this on a CD if you have to), but that way you are sure you can install them if necessary.

    Here's some psuedocode that I would use when trying to address the problem that you're describing:

    1. get the list of packages currently installed:
       @packages = split /\n/,`ppm query -a`;
    2. loop through your list of required packages and grep for the package name in the list @packages:
       foreach $package (@required){ if( ! grep $package, @packages )
    3. if the package you need is not in the list, then install it:
       system("ppm install $package");
    4. once through the list of required packages, go on about the rest of your installation steps.

    Not sure if this is any help, but maybe something to think about. Good luck!

    ~CubicSpline
    "No one tosses a Dwarf!"

Re: writing a nice installation program/script
by Jaap (Curate) on Jul 30, 2002 at 14:15 UTC
    You might also handle the problem differently on win32 and linux. For windows there's MS's .msi "microsoft installer" format which works on win 2000+ and win me. It works pretty wel...

    For linux you might consider using make or ant or rpm or whatever.
Re: writing a nice installation program/script
by NaSe77 (Monk) on Jul 30, 2002 at 08:56 UTC
    Update: the script should work on win32 and linux

    another update: the people who should work with it are normal computer users and have no idea of perl

    ----
    NaSe
    :x