NAME
Lang::Tree::Builder::Data - Tree Data
SYNOPSIS
use Lang::Tree::Builder::Parser;
my $parser = new Lang::Tree::Builder::Parser();
my $data = $parser->parseFile($datafile);
foreach my $class ($data->classes()) {
my $parent = $class->parent();
my @args = $class->args();
my $name = $class->name();
# etc
}
This package contains an ever-growing list of accessor methods to make the maintainance and extension of templates easy. See below for the full list.
DESCRIPTION
new
my $class = new Lang::Tree::Builder::Class(%params);
Creates and returns a new instance of Class. Don't do this, the parser does it for you, however for reference, %params
is:
- class
-
The class name.
- parent
-
The parent class name, if any.
- args
-
The arguments to the constructor, will be passed to Lang::Tree::Builder::Args::List()
- abstract
-
True if the class was declared abstract.
Note that each class is unique, and that additional calls to new
may be used to add information to an existing class object which will then be returned. It is an error for new information to conflict with existing information however.
name
Returns the fully qualified class name, with parts joined by ::
by default. An alternative join string can be passed as an optional argument.
parent
Returns the parent class, or false if no parent.
args
Returns an array of arguments to the constructor. Each element is a Lang::Tree::Builder::Args
.
numargs
Returns the number of args the constructor accepts.
parts
Returns an array or arrayref of the components of the class name. For example Foo::Expr
has parts Foo
and Expr
.
lastpart
Returns the last component of parts
above.
namespace
Returns all but the last component of parts
, joined with ::
by default, but an alternative can be supplied as an optional argument.
interface
Returns an equivalent interface name by prepending a literal i
to the last part of the class name.
is_scalar
Returns false
is_substantioal
Returns true if the class was defined in the config (as opposed to merely being used as an argument type). Not to be confused with is_concrete
.
is_abstract
Returns true if the class was declared abstract.
is_concrete
Returns true if the class was not declared abstract. N.b. a class is concrete by default, is_substantial
could still return false for the same class.
SEE ALSO
AUTHOR
Bill Hails, <me@billhails.net>
COPYRIGHT AND LICENSE
Copyright (C) 2008 by Bill Hails
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.