Επιλογές CLI#
Το pperl δέχεται ένα μικρό σύνολο σημαιών γραμμής εντολών. Οι περισσότερες είναι συμβατές με το perl· λίγες είναι ειδικές για το pperl (JIT, παραλληλισμός, επιλογή runtime, cache bytecode). Η αυθεντική λίστα είναι ό,τι τυπώνει το pperl --help· οι παρακάτω πίνακες δείχνουν αυτές τις σημαίες, εξαγμένες από τον πηγαίο κώδικα του διερμηνευτή και αποτυπωμένες εδώ σε κάθε χτίσιμο της τεκμηρίωσης.
Σημείωση
Η πραγματική έξοδος του pperl --help στο τερματικό είναι πάντα στα Αγγλικά - το εκτελέσιμο δεν τοπικοποιεί τα μηνύματα βοήθειας. Η μεταφρασμένη τεκμηρίωση παρουσιάζει τις ίδιες σημαίες με περιγραφές στη γλώσσα της σελίδας, ώστε οι αναγνώστες να μελετήσουν τι κάνει η καθεμία· τα ίδια τα ονόματα των σημαιών (-T, --threads=N, …) μένουν πάντα αυτούσια.
PetaPerl - Περιβάλλον εκτέλεσης Perl 5 νέας γενιάς
Χρήση#
pperl [OPTIONS] [--] [SCRIPT [ARGS...]]
pperl -e 'code'
pperl -E 'code'
Επιλογές συμβατές με το Perl#
Σημαία | Περιγραφή |
|---|---|
| Αριθμητικά μονογραμμικά και μονογραμμικά ημερομηνιών |
| Like -e, but enable all optional features (say, …) |
| use module before executing (-MO=Deparse, -Mstrict) |
| use module () before executing (no imports) |
| Προσθέτει τον κατάλογο στην αρχή του @INC |
| Έλεγχος μόνο της σύνταξης, χωρίς εκτέλεση |
| Ενεργοποίηση προειδοποιήσεων |
| Loop over input lines (no auto-print), like while(<>) |
| Loop over input lines and auto-print, like a sed filter |
| Autosplit each line into @F (with -n or -p) |
| Set the -a split pattern (implies -a) |
| Αυτόματο chomp της εισόδου, ορισμός τερματιστή εγγραφής εξόδου |
| Set input record separator (-0 = NUL, -00 = paragraph) |
| Edit files in place (optional backup extension) |
| Taint mode (forced) |
| Ενεργοποίηση προειδοποιήσεων |
| Εμφάνιση πληροφοριών έκδοσης |
| Show configuration summary, %ENV and @INC |
| Show the value of a Config key, e.g. -V:archname |
| Launch interactive REPL (requires “shell” feature) |
| Εμφάνιση αυτού του μηνύματος βοήθειας |
Επιλογές ειδικές για το pperl#
Σημαία | Περιγραφή |
|---|---|
| Εμφάνιση στατιστικών απόδοσης (χρόνος, μνήμη, ops) |
Επιλογές runtime#
Σημαία | Περιγραφή |
|---|---|
| Απενεργοποίηση μεταγλώττισης JIT (ενεργή από προεπιλογή) |
| Απενεργοποίηση αυτόματης παραλληλοποίησης (ενεργή από προεπιλογή) |
| Parallel thread count. SPEC is one of: |
| all physical cores (DEFAULT) |
| all logical cores (hyperthreads) |
| physical minus N (min 1) |
| logical minus N (min 1) |
| P percent of logical cores |
| an explicit count |
| Ελάχιστος αριθμός επαναλήψεων για παραλληλοποίηση (προεπιλογή: 100) |
| Print JIT summary to stderr at exit (see also PPERL_JIT_LOG) |
Daemon options#
Σημαία | Περιγραφή |
|---|---|
| Run the fast-start daemon in the foreground |
| Start the daemon in the background |
| Stop the running daemon for this binary |
| Show daemon status and cached script templates |
| Daemon exits after SECS without a request (default: 900) |
| Cache at most N script templates (default: 100) |
| Drop all cached script templates |
| Drop the cached template for FILE only |
| Route this run through the daemon, same as PPERL_DAEMON=1 |
| Reuse a per-script template, same as PPERL_DAEMON=2 |
| Print the binary identity that keys the daemon socket |
Παραδείγματα#
pperl script.pl
Εκτέλεση ενός σεναρίου Perl
pperl -E 'say "Hello!"'
Εκτέλεση μονόγραμμου (τα say, state κ.λπ. είναι πάντα διαθέσιμα)
pperl -c script.pl
Έλεγχος σύνταξης σεναρίου χωρίς εκτέλεση
pperl script.pl arg1 arg2
Πέρασμα ορισμάτων στο σενάριο (@ARGV)
Για περισσότερες πληροφορίες, δείτε: https://gl.petatech.eu/petatech/peta-perl
Module search paths: -I, PERL5LIB, @INC#
-I dir prepends dir to @INC, exactly like perl. Entries from -I and from the PERL5LIB environment variable (PERLLIB as the fallback; both ignored under taint mode) are additionally expanded: if the directory has versioned children (5.44.99, 5.40.0, …), those are added around the entry, nearest perl version first. This makes local::lib- and Carton-style trees built by a real perl work unmodified.
Δύο σκόπιμες διαφορές από την perl:
No architecture subdirectories. perl would also add
dir/5.44/x86_64-linux-style children; pperl never does. It runs no compiled XS objects, so those directories hold nothing it could use, and skipping them avoids loading.pmwrappers that would die trying to bootstrap.sofiles.Native modules win over every
@INCentry. Modules built into the pperl binary (seePPERL_MODSbelow) are served directly byrequire; a same-name.pmon disk is never loaded in front of them, no matter what-Isays.
Two pperl-private search locations exist for parallel installations, so a module can be provided to pperl WITHOUT touching the shared perl trees:
The
PPERL5LIBenvironment variable: same syntax and expansion asPERL5LIB, honored immediately before it.The pperl overlay trees, probed before every host perl tree:
/usr/local/share/pperl/site_perl(local overrides),/usr/share/pperl/site_perland/usr/share/pperl/vendor_perl(packaged), each optionally with versioned children.
A .pm in either location outranks all host trees for pperl only - the host perl never looks there. Neither can outrank a module built into the binary.
The rest of @INC is built by probing the host’s standard library trees (Arch, Debian and Fedora layouts) rather than baking one distribution’s paths into the binary; pperl -V prints the real result. Details and rationale: differences from upstream and the @INC reference in program input.
Μεταβλητές περιβάλλοντος#
Το pperl ορίζει διάφορες μεταβλητές περιβάλλοντος εντός της διεργασίας που εκτελεί, ώστε τα σενάρια να μπορούν να εξετάσουν τον τρέχοντα διερμηνευτή:
Μεταβλητή | Σημασία |
|---|---|
| Συμβολοσειρά έκδοσης (ίδια με του |
| Λίστα διαχωρισμένων με κόμμα ενσωματωμένων χαρακτηριστικών Cargo |
| Ζεύγη |
| Παραλλαγή ενσωμάτωσης shell (κενή εάν το χαρακτηριστικό |
|
|
Εκτελέστε pperl -V για να δείτε όλες τις τιμές για το τρέχον εκτελέσιμο.