The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

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 effectively 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

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.

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.