| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package XML::Toolkit::Loader; |
|
2
|
|
|
|
|
|
|
{ |
|
3
|
|
|
|
|
|
|
$XML::Toolkit::Loader::VERSION = '0.15'; |
|
4
|
|
|
|
|
|
|
} |
|
5
|
2
|
|
|
2
|
|
5661
|
use Moose; |
|
|
2
|
|
|
|
|
6
|
|
|
|
2
|
|
|
|
|
18
|
|
|
6
|
2
|
|
|
2
|
|
20711
|
use namespace::autoclean; |
|
|
2
|
|
|
|
|
6
|
|
|
|
2
|
|
|
|
|
23
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
has filter => ( |
|
9
|
|
|
|
|
|
|
isa => 'XML::Toolkit::Loader::Filter', |
|
10
|
|
|
|
|
|
|
is => 'ro', |
|
11
|
|
|
|
|
|
|
required => 1, |
|
12
|
|
|
|
|
|
|
handles => [qw(root_object)], |
|
13
|
|
|
|
|
|
|
); |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
has generator => ( |
|
16
|
|
|
|
|
|
|
isa => 'XML::Toolkit::Generator', |
|
17
|
|
|
|
|
|
|
is => 'ro', |
|
18
|
|
|
|
|
|
|
required => 1, |
|
19
|
|
|
|
|
|
|
handles => [qw(render_object output)], |
|
20
|
|
|
|
|
|
|
); |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
has parser => ( |
|
23
|
|
|
|
|
|
|
is => 'ro', |
|
24
|
|
|
|
|
|
|
required => 1, |
|
25
|
|
|
|
|
|
|
handles => [qw(parse_uri parse_file parse_string)] |
|
26
|
|
|
|
|
|
|
); |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
before [qw(parse_uri parse_file parse_string)] => |
|
29
|
|
|
|
|
|
|
sub { shift->filter->reset_state }; |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub render { |
|
32
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
|
33
|
0
|
|
|
|
|
|
$self->render_object( $self->root_object ); |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
|
37
|
|
|
|
|
|
|
1; |
|
38
|
|
|
|
|
|
|
__END__ |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 NAME |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
XML::Toolkit::Loader - A set of tools for Loading XML into Moose Objects |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 VERSION |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
version 0.15 |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
use XML::Toolkit::Loader; |
|
51
|
|
|
|
|
|
|
my $loader = XML::Toolkit::Loader->new( namespace => 'MyApp' ); |
|
52
|
|
|
|
|
|
|
$loader->parse_file( $file ); |
|
53
|
|
|
|
|
|
|
print join '', @{ $loader->render }; |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=over |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=item filter - An XML::SAX Filter |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
The render method is required. This is the class that renders the parsed |
|
62
|
|
|
|
|
|
|
events into a set of Moose Objects. XML::Toolkit::Loader::Filter documented |
|
63
|
|
|
|
|
|
|
elsewhere in this distribution is the default implementation. |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=item generator - An XML::Toolkit::Generator |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
The render method is required. This is the class that renders a set of Moose |
|
68
|
|
|
|
|
|
|
objects parsed by the Filter into XML again. XML::Toolkit::Generator |
|
69
|
|
|
|
|
|
|
documented elsewhere in this distribution is the default implementation. |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=item parser - A Parser Object |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
The methods parse_uri, parse_file and parse_string are required. This defaults |
|
74
|
|
|
|
|
|
|
to a XML::SAX::ParserFactory parser. |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=back |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 METHODS |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=over |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=item render() |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
Render the current root_object via the XML::Toolkit::Generator's render_object method |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=back |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 INCOMPATIBILITIES |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
None reported. |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 BUGS AND LIMITATIONS |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
No bugs have been reported. |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Please report any bugs or feature requests to |
|
97
|
|
|
|
|
|
|
C<bug-xml-toolkit@rt.cpan.org>, or through the web interface at |
|
98
|
|
|
|
|
|
|
L<http://rt.cpan.org>. |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 AUTHOR |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
Chris Prather C<< <chris@prather.org> >> |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 LICENCE AND COPYRIGHT |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
Copyright (c) 2008, Chris Prather C<< <chris@prather.org> >>. Some rights reserved. |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
This module is free software; you can redistribute it and/or |
|
110
|
|
|
|
|
|
|
modify it under the same terms as Perl itself. See L<perlartistic>. |