This Magisk module contains the Perl 5.42 binaries compiled with clang19 using the Android SDK r27b

ASUS_I006D:/ $ perl --version

This is perl 5, version 42, subversion 0 (v5.42.0) built for aarch64-linux-android

Copyright 1987-2025, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl".  If you have access to the
Internet, point your browser at https://www.perl.org/, the Perl Home Page.

ASUS_I006D:/ $ 


The perl executables and scripts are installed in /system/usr/bin:

ASUS_I006D:/ # ls -l  /system/usr/bin/
total 4766
-rwxr-xr-x 1 root root   15389 2025-07-09 09:59 corelist
-rwxr-xr-x 1 root root    8374 2025-07-09 09:59 cpan
-rwxr-xr-x 1 root root   41900 2025-07-09 09:59 enc2xs
-rwxr-xr-x 1 root root    3079 2025-07-09 09:59 encguess
-rwxr-xr-x 1 root root   28840 2025-07-09 09:59 h2ph
-rwxr-xr-x 1 root root   60948 2025-07-09 09:59 h2xs
-rwxr-xr-x 1 root root    4304 2025-07-09 09:59 instmodsh
-rwxr-xr-x 1 root root    5006 2025-07-09 09:59 json_pp
-rwxr-xr-x 1 root root   15792 2025-07-09 09:59 libnetcfg
lrwxrwxrwx 1 root root      12 2025-07-09 10:02 perl -> ./perl5.42.0
-rwxr-xr-x 1 root root 4184888 2025-07-09 09:59 perl5.42.0
-rwxr-xr-x 2 root root   45604 2025-07-09 09:59 perlbug
-rwxr-xr-x 1 root root     276 2025-07-09 09:59 perldoc
-rwxr-xr-x 1 root root   10831 2025-07-09 09:59 perlivp
-rwxr-xr-x 2 root root   45604 2025-07-09 09:59 perlthanks
-rwxr-xr-x 1 root root    8374 2025-07-09 09:59 piconv
-rwxr-xr-x 1 root root    4550 2025-07-09 09:59 pl2pm
-rwxr-xr-x 1 root root    4055 2025-07-09 09:59 pod2html
-rwxr-xr-x 1 root root   19823 2025-07-09 09:59 pod2man
-rwxr-xr-x 1 root root   13120 2025-07-09 09:59 pod2text
-rwxr-xr-x 1 root root    4067 2025-07-09 09:59 pod2usage
-rwxr-xr-x 1 root root    3737 2025-07-09 09:59 podchecker
-rwxr-xr-x 1 root root   13691 2025-07-09 09:59 prove
-rwxr-xr-x 1 root root    3883 2025-07-09 09:59 ptar
-rwxr-xr-x 1 root root    2659 2025-07-09 09:59 ptardiff
-rwxr-xr-x 1 root root    4409 2025-07-09 09:59 ptargrep
-rwxr-xr-x 1 root root    9996 2025-07-09 09:59 shasum
-rwxr-xr-x 1 root root   19473 2025-07-09 09:59 splain
-rwxr-xr-x 1 root root    8075 2025-07-09 09:59 streamzip
-rwxr-xr-x 1 root root    5181 2025-07-09 09:59 xsubpp
-rwxr-xr-x 1 root root  236618 2025-07-09 09:59 zipdetails
ASUS_I006D:/ # 


Perl is a dynamically linked executable but only for the standard Android OS libraries:

ASUS_I006D:/ # file /system/usr/bin/perl5.42.0
/system/usr/bin/perl5.42.0: ELF shared object, 64-bit LSB arm64, dynamic (/system/bin/linker64), for Android 31, built by NDK r27b (12297006), not stripped
ASUS_I006D:/ # 

ASUS_I006D:/ # ldd /system/usr/bin/perl5.42.0 
	linux-vdso.so.1 => [vdso] (0x789266b000)
	libc.so => /apex/com.android.runtime/lib64/bionic/libc.so (0x788db00000)
	libdl.so => /apex/com.android.runtime/lib64/bionic/libdl.so (0x788daf9000)
	libm.so => /apex/com.android.runtime/lib64/bionic/libm.so (0x788da81000)
ASUS_I006D:/ # 


There are wrapper scripts for the Perl executables in /system/bin:

ASUS_I006D:/ # ls -l /system/bin | grep perl_wrapper
lrwxrwxrwx 1 root root       14 2025-07-09 10:01 perl -> ./perl_wrapper
lrwxrwxrwx 1 root root       14 2025-07-09 10:01 perl5.42.0 -> ./perl_wrapper
-rwxr-xr-x 1 root root      241 2025-07-09 10:00 perl_wrapper
lrwxrwxrwx 1 root root       14 2025-07-09 10:01 perlbug -> ./perl_wrapper
lrwxrwxrwx 1 root root       14 2025-07-09 10:01 perldoc -> ./perl_wrapper
lrwxrwxrwx 1 root root       14 2025-07-09 10:01 perlivp -> ./perl_wrapper
lrwxrwxrwx 1 root root       14 2025-07-09 10:01 perlthanks -> ./perl_wrapper
ASUS_I006D:/ #


The customize script creates the CPAN config file

/data/local/tmp/perl_home/.cpan/CPAN/MyConfig.pm

if it does not yet exist.

Using this config file cpan installs additional Perl modules in the directory

/data/local/tmp/perl_home/perl5




Notes


The environment variable HOME must contain the name of directory on a writable filesystem to use cpan.
The wrapper script used in this Magisk Module for all perl executables in /system/bin, /system/bin/perl_wrapper, sets the variable HOME to /data/local/tmp/perl_home if it is empty or contains "/"
(in the default config in adb shells in Android the variable HOME is "/")


To print the list of directories used for perl modules use the command

perl -e 'print join "\n", @INC'

e.g.:

ASUS_I006D:/ $ perl -e 'print join "\n", @INC'
/data/local/tmp/perl_home/lib/perl5
/system/usr/lib/perl5/5.42.0/aarch64-linux-android
/system/usr/lib/perl5/5.42.0
/system/usr/lib/perl5/site_perl/5.42.0/aarch64-linux-android
/system/usr/lib/perl5/site_perl/5.42.0
/system/usr/lib/perl5/5.42.0/aarch64-linux-android
/system/usr/lib/perl5/5.42.0ASUS_I006D:/ $ 



The perl binaries and libraries were compiled using the clang19 from this Magisk Module

http://bnsmb.de/files/public/Android/clang19_19.0.0git-v1.2.2.zip

The yacc executable required by the config script from the Perl source was installed using this Magisk Module

http://bnsmb.de/files/public/Android/bison_flex_1.1.0.zip

The directory structure in this Magisk Module with the perl file was created on a phone using an overlay mount created with the script

http://bnsmb.de/files/public/Android/create_overlay_mount.sh

The config files used to compile perl are in the directory ./source in the Magisk module
 
