Ξεκινώντας#

Εγκατάσταση#

Κατεβάστε εκτελέσιμα και βρείτε τεκμηρίωση στο 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)