in reply to Re^4: Installer for Perl Application
in thread Installer for Perl Application

You could create a bundle from strawberry perl and your app, installing strawberry first, then your app, all from a single SETUP.EXE. Many installer generators seem to support such constructs, at least I saw such constructs several times when I reinstalled a Windoze machine recently.

You could use a simple ZIP SFX, configured to unpack the strawberry installer and your app into a temp directory, then to run a batch file. In the batch file, check that C:\strawberry\perl\bin\perl.exe exists, otherwise run the strawberry setup. Then, install your application. If you don't like the pain of DOS batch files, interpret the batch file as perl code. Something like this (untested!):

@echo off echo Searching Perl Interpreter ... if not exist c:\strawberry\perl\bin\perl.exe goto usesbp rem # no strawberry perl, perhaps ActiveState? if exist c:\perl\bin\perl.exe goto useap rem # nope, any other perl along the path? perl -e "print qq/Found Version $]\n/; exit 42" if errorlevel 43 goto noperl if errorlevel 42 goto haveperl :noperl echo No perl found, installing Strawberry Perl ... strawberry-perl-5.x.y.z.exe /command /line /parameters /for /silent /i +nstall :usesbp PATH=C:\strawberry\c\bin;c:\strawberry\perl\bin;%PATH% rem # ^-- PATH is not automatically updated after installation for THI +S batch rem # paranoia: do we really have a working perl? perl -e "exit 42" if errorlevel 43 goto brokensbp if errorlevel 42 goto haveperl :brokensbp echo Perl installation failed! goto die :useap PATH=C:\perl\bin;%PATH% rem # paranoia: do we really have a working perl? perl -e "exit 42" if errorlevel 43 goto brokenap if errorlevel 42 goto haveperl :brokenap echo Existing Perl installation is broken! goto die :haveperl perl -S -x %0 if not errorlevel 1 goto end echo Installer script died unexpectedly! goto die #!perl use 5.010_000; # or any earlier version your app runs with # line 40 # ^-- replace with number of THIS line or the line numbers will n +ot match the source use strict; use warnings; use FindBin; use Cwd; use Archive::Tar; use File::Path qw(mkpath); my $cwd=getcwd(); print "Installer invoked as $FindBin::Script (in directory $FindBin::Bin +),\n", "current directory is $cwd,\n", "Perl is $^X.\n"; my $tar="$FindBin::Bin/myapp.tar.gz"; my $dest="C:/foo/bar"; -f($tar) or die "Could not find myapp.tar.gz in $FindBin::Bin"; -s _ or die "myapp.tar.gz is empty! Died"; # Maybe test for required modules, install missing ones using the CPAN + classes, # perhaps from a compressed repository included in the installer. mkpath($dest); -d($dest) or die "Failed to create $dest"; chdir($dest) or die "Failed to chdir to $dest: $!"; Archive::Tar->extract_archive($tar,1) or die "Failed to unpack $tar: $ +Archive::Tar::error"; print "Finished installing the FooBar application\n"; exit 0; __END__ :die pause :end

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)