PRANG/Graph/Node.pm

filter: Statementstmt 88.8% 8 / 9 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 1 / 2 Podpod 0.0% 0 / 1 totaltotal 75.0% 9 / 12 CC 1 SCAR 4.1
CC
1
Cov
89%
accept_many
2.0
BEGIN
1.0
CRAP 1.5
« PRANG/Graph/Class.pm ↑ Summary PRANG/Graph.pm »
1  
2 package PRANG::Graph::Node;
3  
4 9 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 0 ▶sub accept_many { 0 }
Subroutine accept_many: not called CC=1 SCAR=6.9
Pod undocumented
7  
8 #method accept( XML::LibXML::Node $node, PRANG::Graph::Context $ctx )
9 # returns ($key, $value, $nodeNameIfAmbiguous)
10 9 requires 'accept';
11  
12 #method complete( PRANG::Graph::Context $ctx )
13 # returns Bool
14 9 requires 'complete';
15  
16 #method expected( PRANG::Graph::Context $ctx )
17 # returns (@Str)
18 9 requires 'expected';
19  
20 # method output ( Object $item, XML::LibXML::Element $node, HashRef $xsi )
21 9 requires 'output';
22  
23 9 1;
24  
25 __END__
26  
27 =head1 NAME
28  
29 PRANG::Graph::Node - role for nodes in XML Graph machinery
30  
31 =head1 SYNOPSIS
32  
33 package PRANG::Graph::Foo;
34 with 'PRANG::Graph::Node';
35  
36 =head1 DESCRIPTION
37  
38 This role is essentially an interface which different types of
39 acceptors/emitted in the marshalling machinery must implement.
40  
41 You should hopefully not have to implement or poke into this class,
42 but if you do end up there while debugging then this documentation is
43 for you.
44  
45 =head1 REQUIRED METHODS
46  
47 Currently there are four methods required;
48  
49 =head2 B<accept( XML::LibXML::Node $node, PRANG::Graph::Context $ctx ) returns ($key, $value, $nodeNameIfAmbiguous)>
50  
51 Given an XML node, completely and recursively parse that node,
52 construct an object and return that object along with the name of the
53 node if the schema requires it.
54  
55 Updates C<$ctx> with any parse state affected by the operation.
56  
57 =head2 B<complete( PRANG::Graph::Context $ctx ) returns Bool>
58  
59 Returns true if the acceptor could be happy with the amount of parsing
60 that has been recorded in C<$ctx> or not.
61  
62 =head2 B<expected( PRANG::Graph::Context $ctx ) returns (@Str)>
63  
64 If there has not been enough accepted, then this function returns
65 something useful for building a helpful exception message.
66  
67 =head2 B<output( Object $item, XML::LibXML::Element $node, HashRef $xsi)>
68  
69 Given the item C<$item>, marshall to XML by constructing new LibXML nodes and attaching to C<$node>; C<$xsi> is the current XML namespaces mapping.
70  
71 =head1 SEE ALSO
72  
73 L<PRANG::Graph::Meta::Class>, L<PRANG::Graph::Meta::Attr>,
74 L<PRANG::Graph::Meta::Element>, L<PRANG::Marshaller>,
75 L<PRANG::Graph::Context>
76  
77 Implementations:
78  
79 L<PRANG::Graph::Seq>, L<PRANG::Graph::Quant>, L<PRANG::Graph::Choice>,
80 L<PRANG::Graph::Element>, L<PRANG::Graph::Text>
81  
82 =head1 AUTHOR AND LICENCE
83  
84 Development commissioned by NZ Registry Services, and carried out by
85 Catalyst IT - L<http://www.catalyst.net.nz/>
86  
87 Copyright 2009, 2010, NZ Registry Services. This module is licensed
88 under the Artistic License v2.0, which permits relicensing under other
89 Free Software licenses.
90  
91 =cut
92  
« PRANG/Graph/Class.pm ↑ Summary PRANG/Graph.pm »