OP here, I'm guessing the documentation is more advanced than the code and
none of the "
other ways of invoking embedded scripts" have actually been implemented yet (or bugs exist).
Commenting line 1185 in APPerl.pm lets the build happen but does not enable default_script:
$sentinelpos != -1 or die "Failed to find APPERL_DEFAULT_SCRIPT, is th
+is an old APPerl binary?";
From the docs:
APPERL_SCRIPTNAME - When the environment variable APPERL_SCRIPTNAME is set, APPerl
attempts to load the basename of APPERL_SCRIPTNAME without file extension from /zip/bin
or opens the perl interpreter like normal if it is perl.
export APPERL_SCRIPTNAME=hello
echo $APPERL_SCRIPTNAME
hello
DOES NOT WORK!
From the docs:
APPERL_DEFAULT_SCRIPT - If argv[0] doesn't yield a valid target either, if the APPERL_DEFAULT_SCRIPT field inside of the binary is set, APPerl will attempt to load that. This way is meant for APPerl application authors to protect against accidental rename messing up argv[0] script execution. "BUILDING AN APPLICATION FROM EXISTING APPERL" shows how to set it with "default_script", but you could also set/change it, by searching for APPERL_DEFAULT_SCRIPT in a hex editor and modifying it.
APPERL_DEFAULT_SCRIPT is not found in the binary when using a hex editor!
perl.com --assimilate does not help
Looking at perl.com with a hex editor does reveal a change when setting default_script in
apperl-project.json.
Start of perl.com without default_script (minus weird chars):
MZqFpD='
ø@JT' <<'@'
Start of perl.com with default_script:
MZqFpD='
ø/zip/bin/helloJT' <<'@'