6 ms·
Author here. Nice comparison. By default (and the released) APPerl binaries do not self-modify (they use the non-self modifying ape loader) however on unix-like
by G4Vi 4y ago
Author here. Nice comparison. By default (and the released) APPerl binaries do not self-modify (they use the non-self modifying ape loader) however on unix-like they install the APE loader to`$HOME/.ape`and use that ELF executable to run the APE. To skip the fork+exec to the ape loader, they can be assimilated with `--assimilate`, that does turn the APE executable into ELF.
There is a kernel patch to add APE (Actually Portable Executable) support to Linux removing the need for the the apeloader or assimilating. I'm not sure what the status is on that.
- G4Vi 4y agoI forgot to mention APPerl and StaticPerl have many overlapping use cases, but APPerl is more tailored to application packaging. APPerl is built with a patch to Perl adding argv[0] script execution, allowing the APPerl binary to turn into a binary for any of the embedded scripts, with a rename or symlink rather then needing to pass flags the Perl executable to load modules.
- csdvrx 4y agoCould you suggest a way to do electron-like apps in APPerl? I'm thinking of serving content on 127.0.0.2. There is no need for a high performance server like nginx, but serving files and having some CGI capability would be a plus. I'd be interested in suggestions for the HTTP server part and maybe an example for how do serve an index.pl file that reads payload files packaged in the APPerl binary (ex: .js, .jpg)
- G4Vi 4y agoI would first create a script that runs a web server that performs as expected (serving files, and handling dynamic functionality in the script or in a perl module, or by paths to cgi scripts as needed). I rolled by own for packing my personal http media server (MHFS), but there's plenty of HTTP servers on CPAN. I'm not sure which one's are best. Then, I would create a custom build of APPerl using Perl::Dist::APPerl 's apperlm and modifying the apperl-project.json to pack in the script, CPAN modules, cgi files, and the static resources into a APPerl binary. When bundled into APPerl, the script can read the files embedded in APPerl from the /zip path. Perl::Dist::APPerl (with tutorial on building apps): https://metacpan.org/pod/Perl::Dist::APPerl https://metacpan.org/pod/Perl::Dist::APPerl MHFS's APPerl packaging config: https://github.com/G4Vi/MHFS/blob/master/apperl/apperl-project.json https://github.com/G4Vi/MHFS/blob/master/apperl/apperl-proje...
- csdvrx 4y ago> there's plenty of HTTP servers on CPAN. I'm not sure which one's are best. Same. I know about HTTP::Daemon, HTTP::Tiny and HTTP::Server::Simple If you have tried one of the 3 and can confirm it works with APPerl, it might save time? If not, first with HTTP::Daemon (since it shows how to bind to a given IP in https://gist.github.com/mikkun/6388508 https://gist.github.com/mikkun/6388508, unlike HTTP::Tiny) I will try to release something similar to redbean but based on perl and DBD::SQLite > When bundled into APPerl, the script can read the files embedded in APPerl from the /zip path. That much I knew, but I was afraid there might be extra things needed > MHFS's APPerl packaging config: https://github.com/G4Vi/MHFS/blob/master/apperl/apperl-proje https://github.com/G4Vi/MHFS/blob/master/apperl/apperl-proje... Thank you! Then I might go with MHFS at first (tweaking its index.pl), if only because it's been tested by you with APPerl :)
- G4Vi 4y ago> HTTP::Daemon, HTTP::Tiny and HTTP::Server::Simple I haven't tested any. Pure Perl servers should be the easiest to get working. The Cosmopolitan Libc doesn't support fcntl F_SETFL O_NONBLOCK on Windows yet, and so non-blocking / event loop servers may be a no-go for now. > I will try to release something similar to redbean but based on perl and DBD::SQLite I'd like to see this. > Then I might go with MHFS at first I wouldn't consider MHFS's HTTP server "production ready" and suffers from the above mentioned O_NONBLOCK issue, but I'm curious how it would go. If you haven't already, feel free to join the Redbean/Cosmopolitan Libc discord to discuss. (There's a link on the APPerl webpage).
- csdvrx 4y agoFYI, building on windows make it detect Trojan:Win32/Wacatac.H!ml I used your perl.com as an input. Fake positive? Or have you been infected? Also, even if I cpan install the modules and have: "perl_repo_files" : {"cpan" : [ "HTML-Template", "URI", "Class-Inspector", "HTTP-Daemon", "HTTP-Status", "IPC-Open2" } I get: C:\test> .\test.com Can't locate HTTP/Daemon.pm in @INC (you may need to install the HTTP::Daemon module) (@INC contains: . /zip/lib/perl5/site_perl/5.36.0/x86_64-cosmo /zip/lib/perl5/site_perl/5.36.0 /zip/lib/perl5/5.36.0/x86_64-cosmo /zip/lib/perl5/5.36.0) at /zip/bin/test line 9. BEGIN failed--compilation aborted at /zip/bin/test line 9. Do I need to use https://github.com/G4Vi/MHFS/blob/master/apperl/download_package.pl https://github.com/G4Vi/MHFS/blob/master/apperl/download_pac... or something else to put the dependencies pm files in the zip?
- G4Vi 4y agoUpdate on the APE Linux kernel support (for fork/ --assimilate)less APE execution. jart informed me: "It's in the process of being emailed out to the kernel developers. I anticipate it'll be merged within the next three months."