B::Bytecode(3perl)

B::Bytecode3perl

Perl compiler's bytecode backend

Usage

perl -MO=Bytecode[,-H][,-oscript.plc] script.pl

Overview

Compiles a Perl script into a bytecode format that could be loaded later by the ByteLoader module and executed as a regular Perl script.

Examples

    $ perl -MO=Bytecode,-H,-ohi -e 'print "hi!\n"'
    $ perl hi
    hi!

Options

-b

Save all the BEGIN blocks. Normally only BEGIN blocks that "require" other files (ex. "use Foo;") are saved.

-H

prepend a "use ByteLoader VERSION;" line to the produced bytecode.

-k

keep the syntax tree - it is stripped by default.

-ooutfile

put the bytecode in <outfile> instead of dumping it to STDOUT.

-s

scan the script for "# line .." directives and for <goto LABEL> expressions. When gotos are found keep the syntax tree.

Known bugs

•

"BEGIN { goto A: while 1; A: }" won't even compile.

•

"?...?" and "reset" do not work as expected.

•

variables in "(?{ ... })" constructs are not properly scoped.

•

scripts that use source filters will fail miserably.

Notice

There are also undocumented bugs and options.

THIS CODE IS HIGHLY EXPERIMENTAL. USE AT YOUR OWN RISK.

Releases

3 releases since Debian 3.0 (Woody); the text changed 2 times.

  1. 3.0
  2. 3.1
  3. 4.0

-H since Debian 3.1 (Sarge); -b since Debian 3.1 (Sarge); -k since Debian 3.1 (Sarge); -o since Debian 3.1 (Sarge); -s since Debian 3.1 (Sarge).

-- until Debian 3.0 (Woody); -D until Debian 3.0 (Woody); -DC until Debian 3.0 (Woody); -Da until Debian 3.0 (Woody); -Db until Debian 3.0 (Woody); -Do until Debian 3.0 (Woody); -On until Debian 3.0 (Woody); -S until Debian 3.0 (Woody); -afilename until Debian 3.0 (Woody); -f until Debian 3.0 (Woody); -fbypass-nullops until Debian 3.0 (Woody); -fcompress-nullops until Debian 3.0 (Woody); -fomit-sequence-numbers until Debian 3.0 (Woody); -ofilename until Debian 3.0 (Woody); -upackage until Debian 3.0 (Woody).

Authors

Originally written by Malcolm Beattie <[email protected]> and modified by Benjamin Stuhl <[email protected]>.

Rewritten by Enache Adrian <[email protected]>, 2003 a.d.

From perl-doc 5.8.8-7etch6 in Debian 4.0 (Etch). Parsed by carta from the page's man source.