File Coverage

lib/Decl/Semantics/Text.pm
Criterion Covered Total %
statement 10 17 58.8
branch 0 2 0.0
condition n/a
subroutine 4 7 57.1
pod 4 4 100.0
total 18 30 60.0


line stmt bran cond sub pod time code
1             package Decl::Semantics::Text;
2            
3 12     12   78 use warnings;
  12         24  
  12         487  
4 12     12   72 use strict;
  12         27  
  12         521  
5            
6 12     12   70 use base qw(Decl::Node);
  12         42  
  12         4065  
7            
8             =head1 NAME
9            
10             Decl::Semantics::Text - implements a section of text (presumed human-readable)
11            
12             =head1 VERSION
13            
14             Version 0.02
15            
16             =cut
17            
18             our $VERSION = '0.01';
19            
20            
21             =head1 SYNOPSIS
22            
23             Text doesn't do anything, except that it can output itself. Later, there will be a generalized output mechanism, but that's still
24             on the drawing board, so really, text just ... holds text.
25            
26             =head2 defines(), tags_defined()
27            
28             Called by Decl::Semantics during import, to find out what xmlapi tags this plugin claims to implement.
29             The asterisk means indented lines will all be put into the body of this tag even if not surrounded by curly braces.
30            
31             =cut
32            
33 0     0 1 0 sub defines { ('text'); }
34             our %build_handlers = ( text => { node => sub { Decl::Semantics::Text->new (@_) }, body => 'none' } );
35 12     12 1 89 sub tags_defined { Decl->new_data(<
36             text (body=text)
37             EOF
38            
39             =head2 parse_body
40            
41             When used outside the parser, a Text.pm node can have any tag - but it still doesn't ever parse its body.
42            
43             It has ambiguous callability.
44            
45             =cut
46            
47             sub parse_body {
48 0     0 1   my ($self) = @_;
49 0           $self->{callable} = '?';
50             }
51            
52             =head2 go
53            
54             When called, Text writes to itself. By default, that propagates up the tree until an output handler is found.
55            
56             =cut
57            
58             sub go {
59 0     0 1   my ($self) = @_;
60 0 0         if ($self->label) {
61 0           $self->write($self->label);
62             } else {
63 0           $self->write($self->body);
64             }
65             }
66            
67             =head1 AUTHOR
68            
69             Michael Roberts, C<< >>
70            
71             =head1 BUGS
72            
73             Please report any bugs or feature requests to C, or through
74             the web interface at L. I will be notified, and then you'll
75             automatically be notified of progress on your bug as I make changes.
76            
77             =head1 LICENSE AND COPYRIGHT
78            
79             Copyright 2010 Michael Roberts.
80            
81             This program is free software; you can redistribute it and/or modify it
82             under the terms of either: the GNU General Public License as published
83             by the Free Software Foundation; or the Artistic License.
84            
85             See http://dev.perl.org/licenses/ for more information.
86            
87             =cut
88            
89             1; # End of Decl::Semantics::Text