NAME

Decl::Semantics::Code - implements some code (perl or otherwise) in a declarative framework.

VERSION

Version 0.01

SYNOPSIS

This class serves two purposes: first, it's an example of what a semantic node class should look like, and second, it will probably end up being the class that builds most of the code references in a declarative program.

defines(), tags_defined()

Called by Decl::Semantics during import, to find out what tags this plugin claims to implement and the parsers used to build its content.

build_payload, build_macro_payload, fixvars, fixcall, fixevent, fixfind, make_code, make_macro_code, parse_select, make_select, make_dml, make_output, make_ifnew

The build_payload function is then called when this object's payload is built (i.e. in the stage when we're adding semantics to our parsed syntax). The payload of a code object is its callable code result.

The make_code function builds code in an event context; it actually calls make_macro_code, which does the same in an arbitrary node context that you supply (but that defaults to the event context of the code node).

The parent's payload will always have been created by the time this function is called.

The make_select function is by far the most complex of our code generators, as it has to find an iterator source and build a while loop, or a DBI database and build a query and select loop. The parsing is split out into parse_select in order to make it usable from elsewhere.

The make_dml function handles the non-select DBI keywords (just 'insert', 'update', and 'delete').

The fix* functions munge various things around in our code generation scheme.

The make_output function handles text blocks for output delineated with "<<".

The make_ifnew is probably going overboard with specific select tweaks; I really need to start thinking harder about real macros in the code.

AUTHOR

Michael Roberts, <michael at vivtek.com>

BUGS

Please report any bugs or feature requests to bug-decl at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Decl. 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.