NAME
Class::Declarative::Semantics - provides the framework for a set of semantic classes in a declarative framework.
VERSION
Version 0.01
SYNOPSIS
Class::Declarative
can't really do anything on its own; it depends on a set of semantic classes, one for each type of node in the declarative tree. Setting up a set of semantic classes needs a little glue code, because the top-level class has to search its own set of modules to tell Class::Declarative
what kind of tags it can handle. Class::Declarative::Semantics
does that work for us. It also provides a very minimal core set of semantics so we can test the declarative mechanism itself.
new(), tag()
A semantic class is just a collection of utilities for its plugins. The core Semantics class doesn't really have anything at all - but as other semantic classes will subclass this, your mileage will vary. The one thing we know is that we'll want to keep track of the root.
The tag used to identify a semantic class will differ for each semantic class. It's used to register the class in the root object.
import, scan_plugins
The import
function is called when the package is imported. It checks for submodules (i.e. plugins) and calls their "defines" methods to ask them what tag they claim to implement. Then it gives that back to Class::Declarative
. Most of the work is done in scan_plugins
, because import
has to execute in any subclass module so we can scan the right directory for plugins.
start()
The start
function is called by the framework to start the application if this semantic class is the controlling class. This won't happen too often with the core semantics (except in the unit tests) but the default behavior here is to execute each callable child of the top-level application in turn.
do()
Each semantic module can accept events/commands issued to its name. They are sent to the do
method here, already parsed.
AUTHOR
Michael Roberts, <michael at vivtek.com>
BUGS
Please report any bugs or feature requests to bug-class-declarative at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Class-Declarative. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
LICENSE AND COPYRIGHT
Copyright 2010 Michael Roberts.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.