Getting Started#

Installation#

Download binaries and find documentation at perl.petamem.com.

Dynamic and static binaries#

pperl comes in two linkages.

The dynamically linked binary uses the system’s C library and loads the C libraries its modules need when they are first used: OpenSSL for Net::SSLeay, libxml2 for XML::LibXML, liblmdb for DB_File, and so on. A module whose library is not installed fails to load with a message naming the library and how to install it. The binary needs a C library at least as new as the one it was built with; on an older system, build pperl there.

The static binary contains everything it runs with and needs nothing installed, on any Linux of its architecture. It cannot load a C library at run time, so it leaves out the modules that work only through one:

  • TLS and cryptography: Net::SSLeay, IO::Socket::SSL, Crypt::OpenSSL::*, Crypt::PK::Ed25519

  • XML: XML::LibXML, XML::LibXSLT, XML::Parser

  • Math::GMP; bzip2 compression (Compress::Raw::Bzip2, IO::Compress::Bzip2, IO::Uncompress::Bunzip2)

  • DB_File, GDBM_File, NDBM_File, ODBM_File and LMDB_File (SDBM_File is there)

  • Cairo, GD, SDL2, Imager’s FreeType fonts, Peta::WebGPU

  • calling C libraries from Perl: Peta::FFI and the bindings built on it, FFI::Platypus, and the database drivers over them (DBD::SQLite, DBD::Pg, DBD::MariaDB, DBD::Sybase). Peta::FFI::Libc, which calls the C library inside pperl, is there.

Loading one of them fails at once and says why:

Can't locate Net/SSLeay.pm in @INC (you may need to install the Net::SSLeay module) (not supported by a static pperl, which cannot load libssl)

A copy of the module elsewhere on @INC is not tried. Everything else, zlib compression, the digests and the rest of perl’s library included, works as in the dynamic binary. pperl -V:usedl tells them apart: usedl='define' for the dynamic binary, usedl='undef' for the static one.

First Script#

#!/usr/bin/env pperl
print "Hello from PetaPerl!\n";

Command Line Options#

Option

Description

-e 'code'

Execute one-liner

-E 'code'

Like -e, with all optional features enabled (say, …)

-I dir

Prepend dir to the module search path @INC

-c

Check syntax only

-w

Enable warnings

-v

Show version

-V

Show configuration, %ENV and @INC

--no-jit

Disable JIT compilation

--no-parallel

Disable auto-parallelization

See CLI options for the full option list.

Notes#

  • Defaults match perl: modern features (say, state and friends) are enabled by use v5.44; in scripts or -E for one-liners

  • XS modules are not supported; native Rust reimplementations are provided for common modules

  • Module search paths work as in perl: -I and the PERL5LIB environment variable are honored; PPERL5LIB additionally provides pperl-only paths (see CLI options)