On Thu, Feb 08, 2001 at 08:53:07AM -0000, Filipe Brandenburger wrote:
> The solution I propose to this problem is borrowed (copied) from what Java 
> did in version 1.1 with jars (did wrong, of course), and somewhat like 
> RedHat's rpms. What I suggest is having a kind of archive that would be like 
> a container for all the code needed to run the thing, so that it can be 
> downloaded and installed all at once. Not .tgz, but a thing that perl could 
> recognize at his own's. A tool (`perlinstall', or something like that) 
> distributed with perl would take this package and extract scripts, modules, 
> ..., and install it in the right places, with minimal (ideal zero) user 
> choices.

> Comments?

If you don't need XS modules (or anything else that requires the services
of Makefile.PL or some other install type script on the end machine) is
is possible to put the necessary modules in a zip file, append the zip
file to the perl script after __END__
run zip -A to "adjust the self-extracting exe" and you have a single file
which is both a valid perl script (at the front) and a valid zip file
(at the end)

If you have a perl capable of reading @INC from zip files - I've produced 2
different patches for perl5 that could do this (1 using source filters,
1 using sfio) then you 

BEGIN {unshift $0, @INC}

and your versions of the modules are used if no others are found without
even needing to unzip anything.

problems
1: you can't rely on EOF on the DATA handle in main
2: your script has to be transfered in binary mode ftp, and not mangled
   by any web browsers when saved
3: you really need the new perlio implementation in 5.7 to make it work
   best in a "vanilla" perl
   I'm working towards being able to do this (see the experimental
   PerlIO::gzip on CPAN for gunzip in a perlio layer)
4: Can't do XS
5: not sure if it's a sick hack or an elegant hack

It is also possible to place the include zipfile on the end of the perl
executable and put $^X in @INC to make a 1 file perl distribution, but
I don't think anyone ever tried this

Nicholas Clark

Reply via email to