תחילת העבודה#

התקנה#

ניתן להוריד קבצים בינאריים ולמצוא תיעוד בכתובת 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.

הסקריפט הראשון#

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

אפשרויות שורת הפקודה#

אפשרות

תיאור

-e 'code'

הרצת שורת־קוד אחת

-E 'code'

כמו -e, עם כל התכונות האופציונליות מופעלות (say, …)

-I dir

הוספת dir בראש נתיב חיפוש המודולים @INC

-c

בדיקת תחביר בלבד

-w

הפעלת אזהרות

-v

הצגת הגרסה

-V

הצגת התצורה, %ENV ו־@INC

--no-jit

השבתת קומפילציית JIT

--no-parallel

השבתת הקבלה אוטומטית

ראו אפשרויות CLI לרשימת האפשרויות המלאה.

הערות#

  • ברירות המחדל תואמות ל־perl: תכונות מודרניות (say, state וחבריהן) מופעלות על ידי use v5.44; בסקריפטים או על ידי -E לחד־שורתיים

  • מודולי XS אינם נתמכים; מסופקות מימושים חדשים ב־Rust עבור מודולים נפוצים

  • נתיבי חיפוש המודולים פועלים כמו ב־perl: -I ומשתנה הסביבה PERL5LIB מכובדים; PPERL5LIB מספק בנוסף נתיבים ייחודיים ל־pperl (ראו אפשרויות CLI)