Acme::Perl::VM - A Perl5 Virtual Machine in Pure Perl (APVM)
This document describes Acme::Perl::VM version 0.006.
use Acme::Perl::VM; run_block{ print "Hello, APVM world!\n", };
Acme::Perl::VM is an implementation of Perl5 virtual machine in pure Perl.
Acme::Perl::VM
Perl provides a feature to access compiled syntax trees (opcodes) by B module. B::* modules walk into opcodes and do various things; B::Deparse retrieves Perl source code from subroutine references, B::Concise reports formatted syntax trees, and so on.
B
B::*
B::Deparse
B::Concise
This module also walks into the opcodes, and executes them with its own ppcodes.
You can run any Perl code:
use Acme::Perl::VM; run_block { print "Hello, APVM world!\n"; };
This code says Hello, APVM world to stdout as you expect.
stdout
Here is a more interesting example:
BEGIN{ $ENV{APVM} = 'trace' } use Acme::Perl::VM; run_block { print "Hello, APVM world!\n"; };
And you'll get a list of opcodes as the code runs:
.entersub(&__ANON__) VOID .nextstate(main -:4) VOID .pushmark SCALAR .const("Hello, APVM world!\n") SCALAR .print SCALAR KIDS Hello, APVM world! .leavesub KIDS
The first entersub is the start of the block. The next nextstate indicates the statement that says hello. pushmark, const, and print are opcodes which runs on the statement. The last leavesub is the end of the block. This is a future of the module.
entersub
nextstate
pushmark
const
print
leavesub
In short, the module has no purpose :)
Perl 5.8.1 or later.
No bugs have been reported.
Please report any bugs or feature requests to the author.
Goro Fuji (gfx) <gfuji(at)cpan.org>.
perlapi.
perlhack.
pp.h for PUSH/POP macros.
pp.c, pp_ctl.c, and pp_hot.c for ppcodes.
op.h for opcodes.
cop.h for COP and context blocks.
scope.h and scope.c for scope stacks.
pad.h and pad.c for pad variables.
run.c for runops.
B.
B::Concise.
Devel::Optrace.
Copyright (c) 2009, Goro Fuji (gfx). Some rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Acme::Perl::VM, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Acme::Perl::VM
CPAN shell
perl -MCPAN -e shell install Acme::Perl::VM
For more information on module installation, please visit the detailed CPAN module installation guide.