Sam Crawley > PRANG > PRANG::Graph::Meta::Class

Download:
PRANG-0.17.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Module Version: 0.17   Source  

NAME ^

PRANG::Graph::Meta::Class - metaclass metarole for PRANG-enabled classes

SYNOPSIS ^

 package MyClass;
 use Moose;
 use PRANG::Graph;

 # - or -
 package MyClass;
 use Moose -traits => ["PRANG"];

 # - or -
 package MyClass;
 use Moose;
 PRANG::Graph::Meta::Class->meta->apply(__PACKAGE__->meta);

DESCRIPTION ^

This role defines class properties and methods for PRANG classes' meta objects. ie, the methods it defines are all to be found in YourClass->meta, not YourClass.

The PRANG::Graph::Meta::Class object is the centre of the state machine which defines the parsing and emitting rules for your classes. In other words, the XML Graph (see PRANG). Each one corresponds to an XML element (though not all XML elements will require a full object class), and via these objects can be found the lists of elements and attributes which define the XML structure.

ATTRIBUTES ^

HashRef[HashRef[PRANG::Graph::Meta::Attr]] xml_attr

This read-only property maps from XML namespace and localname to a PRANG::Graph::Meta::Attr object, defining the type of that attribute and other things described on its perldoc.

The first time it is accessed, it is built - so be sure to carry out any run-time meta magic before parsing or emitting objects of that type.

ArrayRef[PRANG::Graph::Meta::Element] xml_elements

This contains an ordered list of all of the XML elements which exist in this class. See PRANG::Graph::Meta::Element.

Like xml_attr, the first time it is accessed it is built. There are currently some problems with ordering and role composition; as the ordering of elements is returned from a moose accessor, but when composing roles into classes, they are applied in any order.

PRANG::Graph::Node graph

The graph property is the acceptor and emitter for the child nodes of this class. See PRANG::Graph::Node for the low-down. This is constructed by a transform on the xml_elements property.

METHODS ^

accept_attributes(\@node_attr, $ctx)

accept_childnodes(\@childNodes, $ctx)

marshall_in_element($node, $ctx)

These methods are the parsing machinery, their API is quite subject to change; the methods provided by the PRANG::Graph role are what you should be using, unless you are writing a PRANG extension.

add_xml_attr($item, $node, $ctx)

to_libxml($item, $node, $ctx)

Similarly, these are the emitting methods.

SEE ALSO ^

PRANG::Graph::Meta::Attr, PRANG::Graph::Meta::Element, PRANG::Graph::Node

AUTHOR AND LICENCE ^

Development commissioned by NZ Registry Services, and carried out by Catalyst IT - http://www.catalyst.net.nz/

Copyright 2009, 2010, NZ Registry Services. This module is licensed under the Artistic License v2.0, which permits relicensing under other Free Software licenses.

syntax highlighting: