Clear questions and runnable code
get the best and fastest answer
perlman:B::Bytecodeby root (Scribe)
|on Dec 23, 1999 at 00:50 UTC||Need Help??|
See the current Perl documentation for B::Bytecode.
Here is our local, out-dated (pre-5.6) version:
B::Bytecode - Perl compiler's bytecode backend
perl -MO=Bytecode[,OPTIONS] foo.pl
This compiler backend takes Perl source and generates a platform-independent bytecode encapsulating code to load the internal structures perl uses to run your program. When the generated bytecode is loaded in, your program is ready to run, reducing the time which perl would have taken to load and parse your program into its internal semi-compiled form. That means that compiling with this backend will not help improve the runtime execution speed of your program but may improve the start-up time. Depending on the environment in which your program runs this may or may not be a help.
The resulting bytecode can be run with a special byteperl executable or
(for non-main programs) be loaded via the
If there are any non-option arguments, they are taken to be names of objects to be saved (probably doesn't work properly yet). Without extra arguments, it saves the main program.
perl -MO=Bytecode,-O6,-o,foo.plc foo.pl
perl -MO=Bytecode,-S foo.pl > foo.S assemble foo.S > foo.plc byteperl foo.plc
perl -MO=Bytecode,-m,-oFoo.pmc Foo.pm
Plenty. Current status: experimental.