File Coverage

blib/lib/Pod/POM/Node/Text.pm
Criterion Covered Total %
statement 23 23 100.0
branch 4 4 100.0
condition 5 8 62.5
subroutine 7 7 100.0
pod 0 3 0.0
total 39 45 86.6


line stmt bran cond sub pod time code
1             #============================================================= -*-Perl-*-
2             #
3             # Pod::POM::Node::Text
4             #
5             # DESCRIPTION
6             # Module implementing specific nodes in a Pod::POM, subclassed from
7             # Pod::POM::Node.
8             #
9             # AUTHOR
10             # Andy Wardley
11             # Andrew Ford
12             #
13             # COPYRIGHT
14             # Copyright (C) 2000, 2001 Andy Wardley. All Rights Reserved.
15             # Copyright (C) 2009 Andrew Ford. All Rights Reserved.
16             #
17             # This module is free software; you can redistribute it and/or
18             # modify it under the same terms as Perl itself.
19             #
20             # REVISION
21             # $Id: Text.pm 89 2013-05-30 07:41:52Z ford $
22             #
23             #========================================================================
24              
25             package Pod::POM::Node::Text;
26             $Pod::POM::Node::Text::VERSION = '2.01';
27             require 5.006;
28 18     18   84 use strict;
  18         31  
  18         451  
29 18     18   81 use warnings;
  18         29  
  18         539  
30              
31 18     18   87 use Pod::POM::Constants qw( :all );
  18         26  
  18         2887  
32 18     18   89 use parent qw( Pod::POM::Node );
  18         31  
  18         90  
33              
34             our @ATTRIBS = ( text => '' );
35              
36             sub new {
37 367     367 0 523 my $class = shift;
38 367         429 my $pom = shift;
39 367         458 my $text = shift;
40             $text = $pom->parse_sequence($text)
41             || return $class->error($pom->error())
42 367 100 50     2284 if length $text && ! $pom->{in_begin};
      66        
43 367         1190 return $class->SUPER::new($pom, $text);
44             }
45              
46             sub add {
47 322     322 0 650 return IGNORE;
48             }
49              
50             sub present {
51 268     268 0 460 my ($self, $view) = @_;
52 268         427 my $text = $self->{ text };
53 268   66     514 $view ||= $Pod::POM::DEFAULT_VIEW;
54              
55 268 100       924 $text = $text->present($view)
56             if ref $text;
57              
58 268         843 return $view->view_textblock($text);
59             }
60              
61             1;
62              
63             =head1 NAME
64              
65             Pod::POM::Node::Text -
66              
67             =head1 SYNOPSIS
68              
69             use Pod::POM::Nodes;
70              
71             =head1 DESCRIPTION
72              
73             This module implements a specialization of the node class to represent text elements.
74              
75             =head1 AUTHOR
76              
77             Andrew Ford Ea.ford@ford-mason.co.ukE
78              
79             Andy Wardley Eabw@kfs.orgE
80              
81             =head1 COPYRIGHT
82              
83             Copyright (C) 2000, 2001 Andy Wardley. All Rights Reserved.
84              
85             Copyright (C) 2009 Andrew Ford. All Rights Reserved.
86              
87             This module is free software; you can redistribute it and/or
88             modify it under the same terms as Perl itself.
89              
90             =head1 SEE ALSO
91              
92             Consult L for a discussion of nodes.