3 ms·
You can do this in pretty much any language. Back in the early 2000's, people used to take the Perl source code and replace the main loop (you know, the part th
by esaym 9y ago
You can do this in pretty much any language. Back in the early 2000's, people used to take the Perl source code and replace the main loop (you know, the part that actually opens files and reads in your "perl scripts") with the text of a cut and pasted perl script. So when the executable ran, instead opening a file, it simply ran the perl code that was nothing but a (giant) string within the perl interpreter executable. Nothing stopping you from including the code from a perl http server or other perl framework instead. I think cpanel did something like this for many years as their toolset was all perl but distributed as a single binary file.
- slobotron 9y agoCan of course still do this with FatPacker: https://metacpan.org/pod/App::FatPacker https://metacpan.org/pod/App::FatPacker But, AFAIK, only supports Pure Perl code, so one is SOL for most database drivers etc...
- esaym 9y agoYea I haven't used fatpacker but I've heard it is only for "pure perl" and can't be used with anything that drops down to XS or C.
- kbenson 9y agoPAR[1] is what you're looking for. It supports loading XS modules by overriding DynaLoader bootstrapping methods; it writes shared object file to a temporary file at the time it is needed. 1: https://metacpan.org/pod/PAR https://metacpan.org/pod/PAR