http://www.perlmonks.org?node_id=11152689

kcott has asked for the wisdom of the Perl Monks concerning the following question:

Background

I don't know how much of this is useful. I've kept it very brief. Ask for more details if you need them.

  1. cpan install Perl::Dist::APPerl v0.3.0 (on openSUSE Leap 15.4 with Perl v5.26.1)
  2. $ apperlm install-build-deps $ apperlm init --name initial_build_config --base full $ apperlm checkout initial_build_config $ apperlm configure $ apperlm build
  3. $ ./perl.com -v This is perl 5, version 36, subversion 0 (v5.36.0) built for x86_64-co +smo (with 6 registered patches, see perl -V for more detail) ... $ ./perl.com -V Summary of my perl5 (revision 5 version 36 subversion 0) configuration +: Commit id: ca87f329eeb075c0fe7ac803eb933f36af45a69b Platform: osname=cosmo ...
  4. Copied perl.com to Win10 platform with Strawberry Perl v5.26.3. Renamed to apperl.com to avoid conflict with (Strawberry) perl.exe.
    C:\Users\ken\tmp>apperl -v This is perl 5, version 36, subversion 0 (v5.36.0) built for x86_64-co +smo (with 6 registered patches, see perl -V for more detail) ... C:\Users\ken\tmp>apperl -V Summary of my perl5 (revision 5 version 36 subversion 0) configuration +: Commit id: ca87f329eeb075c0fe7ac803eb933f36af45a69b Platform: osname=cosmo ...
  5. Copied perl.com to Cygwin platform with Perlbrew Perl v5.36.0.
    $ ./perl.com -v This is perl 5, version 36, subversion 0 (v5.36.0) built for x86_64-co +smo (with 6 registered patches, see perl -V for more detail) ... $ ./perl.com -V Summary of my perl5 (revision 5 version 36 subversion 0) configuration +: Commit id: ca87f329eeb075c0fe7ac803eb933f36af45a69b Platform: osname=cosmo ...

Problem

From "Perl::Dist::APPerl - USAGE":

"APPerl doesn't need to be installed, the output perl.com binary can be copied between computers and ran without installation."

This generally seemed to be the case. I ran various checks (on all platforms): 'use v5.36;' enables the strict and warnings pragmata, and features are enabled or disabled in line with :5.36 bundle; an arbitrary selection of core modules had correct versions.

However, $^O reported cosmo (presumably short for Cosmopolitan Libc) on all platforms. This will cause problems with modules which provide different functionality based on $^O. File::Spec gave good examples of this.

Linux:

$ perl -E 'say $^O' linux $ ./perl.com -E 'say $^O' cosmo $ perl -E 'use File::Spec; say for @File::Spec::ISA;' File::Spec::Unix $ ./perl.com -E 'use File::Spec; say for @File::Spec::ISA;' File::Spec::Unix

Win10:

C:\Users\ken\tmp>perl -E "say $^O" MSWin32 C:\Users\ken\tmp>apperl -E "say $^O" cosmo C:\Users\ken\tmp>perl -E "use File::Spec; say for @File::Spec::ISA;" File::Spec::Win32 C:\Users\ken\tmp>apperl -E "use File::Spec; say for @File::Spec::ISA;" File::Spec::Unix

Cygwin:

$ perl -E 'say $^O' cygwin $ ./perl.com -E 'say $^O' cosmo $ perl -E 'use File::Spec; say for @File::Spec::ISA;' File::Spec::Cygwin $ ./perl.com -E 'use File::Spec; say for @File::Spec::ISA;' File::Spec::Unix

In all of those cases, you really want the perl.com -E ... output to match the perl -E ... output; but all defaulted to File::Spec::Unix.

"Perl::Dist::APPerl - USAGE" goes on to say:

"However, in certain cases such as magic (modifying $0, etc.) The binary must be assimilated for it to work properly. ... cp perl.com perl ./perl --assimilate"

In case that was needed, I tried:

# Win10 C:\Users\ken\tmp>apperl --assimilate Unrecognized switch: --assimilate (-h will show valid options). # Cygwin $ ./perl.com --assimilate Unrecognized switch: --assimilate (-h will show valid options).

I haven't worked with APPerl previously; there's a lot of documentation; it's entirely possible that I've missed a step; misread an instruction; or made some other mistake. I've been over what I've done a number of times but I can't see where I might have gone wrong. It could, of course, be bugs or shortcomings in APPerl itself.

If anyone can shed any light on this it would be greatly appreciated. Thankyou.

— Ken