Anarres-Mud-Driver
view release on metacpan or search on metacpan
lib/Driver/Program.pm view on Meta::CPAN
package Anarres::Mud::Driver::Program;
use strict;
use vars qw(@ISA @EXPORT_OK %EXPORT_TAGS %PROGS);
use Exporter;
use Carp qw(:DEFAULT cluck);
use Data::Dumper;
use File::Basename;
use String::Escape qw(quote printable);
use Anarres::Mud::Driver::Compiler::Type qw(:all);
use Anarres::Mud::Driver::Program::Variable;
use Anarres::Mud::Driver::Program::Method;
use Anarres::Mud::Driver::Program::Efun qw(efuns efunflags);
# This object is big and the 'context'-related stuff and possibly the
# 'generate'-related stuff could be split out.
@ISA = qw(Exporter);
# Oddly enough, the PERL_* tags here must be in order.
@EXPORT_OK = (qw(package_to_path path_to_package
PERL_HEAD PERL_USE PERL_VARS PERL_SUBS PERL_TAIL
PERL_DOCS));
%EXPORT_TAGS = (
sections => [ grep { /^PERL_/ } @EXPORT_OK ],
all => \@EXPORT_OK,
);
# To insert various things into the Perl code.
sub PERL_HEAD () { 0 }
sub PERL_USE () { 1 }
sub PERL_VARS () { 2 }
sub PERL_SUBS () { 3 }
sub PERL_TAIL () { 4 }
sub PERL_DOCS () { 5 }
my $DEBUGLABELS = 0;
%PROGS = (
"/foo/bar" => new Anarres::Mud::Driver::Program(Path=>"/foo/bar"),
);
# Class methods
sub new {
my $class = shift;
my $self = ($#_ == 0) ? { %{ (shift) } } : { @_ };
confess "No Path in program" unless $self->{Path};
$self->{Perl} = [ ];
$self->{PerlGlobals} = [ ];
$self->{Inherits} = { };
$self->{Statics} = { };
$self->{Globals} = { };
$self->{Locals} = { };
$self->{Labels} = { };
$self->{LabelDefault} = undef;
$self->{Methods} = efuns;
$self->{MethodFlags} = efunflags;
$self->{ScopeStack} = [ ];
$self->{LabelStack} = [ ];
$self->{Warnings} = [ ];
$self->{Errors} = [ ];
( run in 0.601 second using v1.01-cache-2.11-cpan-39bf76dae61 )