אפשרויות CLI#

pperl מקבל קבוצה קטנה של דגלי שורת פקודה. רובם תואמי perl; מקצתם ייחודיים ל־pperl (JIT, הקבלה, בחירת סביבת ריצה, מטמון bytecode). הרשימה הקובעת היא מה ש־pperl --help מדפיס; הטבלאות שלהלן מציגות את הדגלים האלה, החולצו ממקור המפרש ומוצגים כאן בכל בנייה של התיעוד.

הערה

פלט pperl --help בפועל בטרמינל הוא תמיד באנגלית - הקובץ הבינארי אינו מתרגם את מחרוזות העזרה. התיעוד המתורגם מציג את אותם דגלים עם תיאורים בשפת העמוד כדי שהקוראים יוכלו לעיין בתפקיד של כל דגל; אסימוני הדגלים (-T, --threads=N, …) נשמרים תמיד כפי שהם.

PetaPerl - סביבת ריצה של Perl 5 מהדור הבא

שימוש#

pperl [OPTIONS] [--] [SCRIPT [ARGS...]]
pperl -e 'code'
pperl -E 'code'

אפשרויות תואמות Perl#

דגל

תיאור

-e 'code'

חד־שורתיים מספריים ושל תאריכים

-E 'code'

Like -e, but enable all optional features (say, …)

-Mmodule

use module before executing (-MO=Deparse, -Mstrict)

-mmodule

use module () before executing (no imports)

-Idirectory

מוסיף תיקייה לתחילת @INC

-c

בדיקת תחביר בלבד, לא מריץ

-w

הפעלת אזהרות

-n

Loop over input lines (no auto-print), like while(<>)

-p

Loop over input lines and auto-print, like a sed filter

-a

Autosplit each line into @F (with -n or -p)

-F pattern

Set the -a split pattern (implies -a)

-l[octal]

בצע chomp אוטומטי לקלט, קבע את מפריד רשומת הפלט

-0[octal]

Set input record separator (-0 = NUL, -00 = paragraph)

-i[ext]

Edit files in place (optional backup extension)

-T

Taint mode (forced)

-t

הפעלת אזהרות

-v

הצגת מידע על הגרסה

-V

Show configuration summary, %ENV and @INC

-V:key

Show the value of a Config key, e.g. -V:archname

--interactive

Launch interactive REPL (requires »shell« feature)

-h, -?, --help

הצגת הודעת עזרה זו

אפשרויות ייחודיות ל־pperl#

דגל

תיאור

--stats, -s

הצגת סטטיסטיקת ביצועים (זמן, זיכרון, ops)

אפשרויות סביבת ריצה#

דגל

תיאור

--no-jit

השבתת קומפילציית JIT (פעיל כברירת מחדל)

--no-parallel

השבתת הקבלה אוטומטית (פעיל כברירת מחדל)

--threads=SPEC

Parallel thread count. SPEC is one of:

phys

all physical cores (DEFAULT)

log

all logical cores (hyperthreads)

phys-N

physical minus N (min 1)

log-N

logical minus N (min 1)

P%

P percent of logical cores

N

an explicit count

--parallel-threshold=N

מינימום איטרציות להקבלה (ברירת מחדל: 100)

--jit-stats

Print JIT summary to stderr at exit (see also PPERL_JIT_LOG)

Daemon options#

דגל

תיאור

--daemon

Run the fast-start daemon in the foreground

--daemon=start

Start the daemon in the background

--daemon=stop

Stop the running daemon for this binary

--daemon=status

Show daemon status and cached script templates

--daemon-idle=SECS

Daemon exits after SECS without a request (default: 900)

--daemon-max-scripts=N

Cache at most N script templates (default: 100)

--daemon-reset

Drop all cached script templates

--daemon-reset=FILE

Drop the cached template for FILE only

--via-daemon

Route this run through the daemon, same as PPERL_DAEMON=1

--via-daemon=script

Reuse a per-script template, same as PPERL_DAEMON=2

--build-id

Print the binary identity that keys the daemon socket

דוגמאות#

pperl script.pl

הרצת סקריפט Perl

pperl -E 'say "Hello!"'

הרצת one-liner (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 .pm wrappers that would die trying to bootstrap .so files.

  • Native modules win over every @INC entry. Modules built into the pperl binary (see PPERL_MODS below) are served directly by require; a same-name .pm on disk is never loaded in front of them, no matter what -I says.

Two pperl-private search locations exist for parallel installations, so a module can be provided to pperl WITHOUT touching the shared perl trees:

  • The PPERL5LIB environment variable: same syntax and expansion as PERL5LIB, 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_perl and /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 מגדיר מספר משתני סביבה בתוך התהליך שהוא מריץ, כדי שסקריפטים יוכלו לבחון את המפרש הפועל:

משתנה

משמעות

PPERL

מחרוזת גרסה (זהה ל־pperl -v)

PPERL_FEATURES

רשימת תכונות Cargo משולבות, מופרדות בפסיקים

PPERL_MODS

זוגות Name/version מופרדים בפסיקים, לכל מודול מקורי

PPERL_SHELL

טעם של אינטגרציית shell (ריק אם תכונת shell כבויה)

PPERL_STATIC

yes אם הקובץ הבינארי קושר באופן סטטי עם musl, אחרת no

יש להריץ pperl -V כדי לראות את כל הערכים עבור הקובץ הבינארי הנוכחי.