PS. I am replying to Ace128 who asked quite essential question, so it do not fit in CB.
But this could be useful in general, I hope.

explanation on how redistributable perl is done with only in-memory unpacks

First of all, previous (lost, but easily recoverable) archive previously located at http://www.vkonovalov.ru/perl-for-cd.zip was perl-5.6.1 + perl/Tk
Currently I placed newer at http://www.vkonovalov.ru/files-exchange/perl58tk84-for-cd.zip which is based on perl-5.8.? and Tk GUI with Tcl/Tk, which is better than perl/Tk. (looks similar but more powerful)

How that works.

start.exe is a tiny C program (explain later) which uses perl58.dll and searches for file './modules/modules.pm' and feeds it to perl interpreter. This bootstraps in such a way that required modules are unzipped and loaded so 'modules/perl58.zip' becomes available to @INC.

Unlike PAR, perl58.zip is not unzipped entirely, only used what is used. Also, just not using filesystem at all could be beneficial in some cases.

How can I make file set even smaller

If I'll go further this easy way, (which probably was the way of all commercial packers), then:

So this ends in 2 files: 1 EXE + 1 DLL, including Tcl/Tk.

start.exe, a tiny C program

Its trivial. It loads perl58.dll, calls RunPerl. Dead simple.

The only trick used (and its not my invention of course) it checks its name to have an idea on what script to run.
So I compiled the stub once, and then I just copy with different name to make engine to start "name.pl" script.
Same as busybox.

// a simple program which executes a perl script at // one of following locations, whichever comes first: // modules/[name].pl // perl/[name].pl // ./[name].pl // modules/executor-resolver.pl // perl/executor-resolver.pl // ./executor-resolver.pl //? modules/[name] //? perl/[name] //? ./[name] #include <windows.h> #include <stdio.h> #include <io.h> #include "EXTERN.h" #include "perl.h" int main(int argc, char *argv[], char **env) { char bufstr[2048]; char fullpath[2048]; char name[2048]; char **xargv = (char**)malloc(sizeof(char*)*(argc+2)); char *script[] = // how to search for script to run { "modules\\", "perl\\", "", 0 }; char history[2048]; int i=0, j, k, rc; bufstr[0]=0; strcpy(history,"tried:\n "); GetModuleFileName(NULL,fullpath,2048); j = strlen(fullpath); while (j && fullpath[j]!='\\') j--; j++; strcpy(name,fullpath+j); k = strlen(name); if (stricmp(name+k-4,".exe")==0) { //okay name[k-4] = 0; } else { MessageBox(0,name,"bad: not able to parse",0); return 1; } //MessageBox(0,name,"good:",0); fullpath[j] = 0; strcpy(bufstr,fullpath); // try with 'name' first for (k=0;script[k];k++) { strcpy(bufstr+j,script[k]); strcat(bufstr+j,name); strcat(bufstr+j,".pl"); strcat(history,bufstr); strcat(history,"\n "); #undef access if (!access(bufstr,0)) { //found it! goto found; } } // try with "executor-resolver.pl" at second set of tries for (k=0;script[k];k++) { strcpy(bufstr+j,script[k]); strcat(bufstr+j,"executor-resolver.pl"); strcat(history,bufstr); strcat(history,"\n "); #undef access if (!access(bufstr,0)) { //found it! //but here script name should be inserted xargv = (char**)malloc(sizeof(char*)*(argc+4)); for (k=0; k<argc; k++) xargv[k+2] = argv[k]; xargv[2] = name; xargv[1] = bufstr; xargv[0] = "perl"; argc += 2; goto run; } } MessageBox(0,history,"Did not found.",0); return -1; found:; //MessageBox(0,name,"!found!",0); xargv = (char**)malloc(sizeof(char*)*(argc+3)); for (k=0; k<argc; k++) xargv[k+1] = argv[k]; xargv[1] = bufstr; xargv[0] = "perl"; argc += 1; run:; rc = RunPerl(argc, xargv, env); free(xargv); return rc; }

Very same could be ported to Linux, of course, I just didn't this...


In reply to Re^2: problem with par as other user by vkon
in thread problem with par as other user by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.