File Coverage

blib/lib/XML/Toolkit/Builder.pm
Criterion Covered Total %
statement 9 9 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 12 12 100.0


line stmt bran cond sub pod time code
1             package XML::Toolkit::Builder;
2             {
3             $XML::Toolkit::Builder::VERSION = '0.15';
4             }
5 2     2   202274 use Moose;
  2         5  
  2         20  
6 2     2   14818 use Moose::Util::TypeConstraints qw(duck_type);
  2         5  
  2         20  
7 2     2   819 use namespace::autoclean;
  2         5  
  2         24  
8              
9             has filter => (
10             isa => 'XML::Toolkit::Builder::Filter',
11             is => 'ro',
12             required => 1,
13             handles => [qw(render)],
14             );
15              
16             has parser => (
17             isa => duck_type( [qw(parse_uri parse_file parse_string)] ),
18             is => 'ro',
19             required => 1,
20             handles => [qw(parse_uri parse_file parse_string)]
21             );
22              
23             __PACKAGE__->meta->make_immutable();
24             1;
25             __END__
26              
27              
28             =head1 NAME
29              
30             XML::Toolkit::Builder - A set of tools for Building XML Classes via XML::SAX Streams
31              
32             =head1 VERSION
33              
34             version 0.15
35              
36             =head1 SYNOPSIS
37              
38             use XML::Toolkit::Builder;
39              
40             my $builder = XML::Toolkit::Builder->new(
41             filter => $filter,
42             parser => XML::SAX::ParserFactory->new( Handler => $filter ),
43             );
44            
45             $self->builder->parse_file( $file );
46             say $builder->render;
47              
48             =head1 ATTRIBUTES
49              
50             =over
51              
52             =item filter - An XML::SAX Filter
53              
54             The render method is required. This is the class that renders the parsed
55             events into a set of Moose classes. XML::Toolkit::Builder::Filter documented
56             elsewhere in this distribution is the default implementation.
57              
58             =item parser - A Parser Object
59              
60             The methods parse_uri, parse_file and parse_string are required. This defaults
61             to a XML::SAX::ParserFactory parser.
62              
63             =back
64              
65             =head1 INCOMPATIBILITIES
66              
67             None reported.
68              
69             =head1 BUGS AND LIMITATIONS
70              
71             No bugs have been reported.
72              
73             Please report any bugs or feature requests to
74             C<bug-xml-toolkit@rt.cpan.org>, or through the web interface at
75             L<http://rt.cpan.org>.
76              
77             =head1 AUTHOR
78              
79             Chris Prather C<< <chris@prather.org> >>
80              
81             =head1 LICENCE AND COPYRIGHT
82              
83             Copyright (c) 2008, Chris Prather C<< <chris@prather.org> >>. Some rights reserved.
84              
85             This module is free software; you can redistribute it and/or
86             modify it under the same terms as Perl itself. See L<perlartistic>.