line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package XML::Generator::Moose; |
2
|
|
|
|
|
|
|
{ |
3
|
|
|
|
|
|
|
$XML::Generator::Moose::VERSION = '0.15'; |
4
|
|
|
|
|
|
|
} |
5
|
2
|
|
|
2
|
|
2479
|
use Moose; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
18
|
|
6
|
2
|
|
|
2
|
|
35261
|
use namespace::autoclean; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
25
|
|
7
|
|
|
|
|
|
|
extends qw(XML::Filter::Moose); |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
has Handler => ( |
10
|
|
|
|
|
|
|
isa => 'Object', |
11
|
|
|
|
|
|
|
is => 'ro', |
12
|
|
|
|
|
|
|
required => 1, |
13
|
|
|
|
|
|
|
handles => [qw(start_document end_document)] |
14
|
|
|
|
|
|
|
); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
after 'start_document' => sub { |
17
|
|
|
|
|
|
|
my ($self) = @_; |
18
|
|
|
|
|
|
|
$self->xml_decl( { Version => '1.0', Encoding => 'UTF-8' } ); |
19
|
|
|
|
|
|
|
$self->newline; |
20
|
|
|
|
|
|
|
}; |
21
|
|
|
|
|
|
|
|
22
|
0
|
|
|
0
|
1
|
|
sub xml_decl { my ( $self, $data ) = @_; $self->Handler->xml_decl($data) } |
|
0
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub start_element { |
25
|
0
|
|
|
0
|
1
|
|
my ( $self, $name, $attr, $data ) = @_; |
26
|
0
|
0
|
|
|
|
|
confess "can't start empty element" unless $name; |
27
|
0
|
|
|
|
|
|
$self->Handler->start_element( |
28
|
|
|
|
|
|
|
{ Name => $name, Attributes => $attr, %$data } ); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub end_element { |
32
|
0
|
|
|
0
|
1
|
|
my ( $self, $name ) = @_; |
33
|
0
|
|
|
|
|
|
$self->Handler->end_element( { Name => $name } ); |
34
|
0
|
|
|
|
|
|
$self->newline; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub characters { |
38
|
0
|
|
|
0
|
1
|
|
my ( $self, $data ) = @_; |
39
|
0
|
|
|
|
|
|
$self->Handler->characters( { Data => $data } ); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub newline { |
43
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
44
|
0
|
|
|
|
|
|
$self->Handler->characters( { Data => "\n" } ); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub cdata { |
48
|
0
|
|
|
0
|
1
|
|
my ( $self, $data ) = @_; |
49
|
0
|
|
|
|
|
|
$self->start_cdata(); |
50
|
0
|
|
|
|
|
|
$self->Handler->characters( { Data => $data } ); |
51
|
0
|
|
|
|
|
|
$self->end_cdata(); |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub start_prefix_mapping { |
55
|
0
|
|
|
0
|
1
|
|
my ( $self, $prefix, $uri ) = @_; |
56
|
0
|
|
|
|
|
|
$self->Handler->start_prefix_mapping( |
57
|
|
|
|
|
|
|
{ Prefix => $prefix, NamespaceURI => $uri } ); |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub end_prefix_mapping { |
61
|
0
|
|
|
0
|
1
|
|
my ( $self, $prefix ) = @_; |
62
|
0
|
|
|
|
|
|
$self->Handler->end_prefix_mapping( { Prefix => $prefix } ); |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub parse { |
66
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
67
|
0
|
|
|
|
|
|
$self->start_document(); |
68
|
0
|
|
|
|
|
|
inner(); |
69
|
0
|
|
|
|
|
|
$self->end_document(); |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
73
|
|
|
|
|
|
|
1; |
74
|
|
|
|
|
|
|
__END__ |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 NAME |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
XML::Generator::Moose - A Moose based subclass of XML::SAX::Base |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 VERSION |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
version 0.15 |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 SYNOPSIS |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
package MySAX::Generator; |
87
|
|
|
|
|
|
|
use Moose; |
88
|
|
|
|
|
|
|
extends qw(XML::Generator::Moose); |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 DESCRIPTION |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
XML::Generator::Moose is a subclass of XML::SAX::Base that provides a standard |
94
|
|
|
|
|
|
|
framework and default implementation of methods for generating SAX events. |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=over |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=item Handler |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=back |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
See Also XML::SAX::Base |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head1 METHODS |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=over |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=item start_element |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=item end_element |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=item characters |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=item newline |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=item cdata |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=item parse |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=back |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
See Also XML::SAX::Base |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head1 INCOMPATIBILITIES |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
None reported. |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head1 BUGS AND LIMITATIONS |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
No bugs have been reported. |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
Please report any bugs or feature requests to |
135
|
|
|
|
|
|
|
C<bug-xml-toolkit@rt.cpan.org>, or through the web interface at |
136
|
|
|
|
|
|
|
L<http://rt.cpan.org>. |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head1 AUTHOR |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
Chris Prather C<< <chris@prather.org> >> |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head1 LICENCE AND COPYRIGHT |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
Copyright (c) 2008, Chris Prather C<< <chris@prather.org> >>. Some rights reserved. |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
This module is free software; you can redistribute it and/or |
147
|
|
|
|
|
|
|
modify it under the same terms as Perl itself. See L<perlartistic>. |