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' <<'@'
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.