blib/lib/Pod/POM/Node/Text.pm

filter: Statementstmt 100% 27 / 27 Branchbran 100% 4 / 4 Conditioncond 62.5% 5 / 8 MC/DCmcdc 20.0% 1 / 5 Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 3 totaltotal 81.4% 44 / 54 CC 6 SCAR 9.3
CC
6
Cov
92%
new
4.1
present
3.0
BEGIN
1.0
CRAP 2.5
« lib/Pod/POM/Test.pm ↑ Summary blib/lib/Pod/POM/Node/Head2.pm »
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 <abw@kfs.org>
11 # Andrew Ford <a.ford@ford-mason.co.uk>
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 18 $Pod::POM::Node::Text::VERSION = '2.01';
27 18 require 5.006;
28 18 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
29 18 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
30  
31 18 ▶use Pod::POM::Constants qw( :all );
Subroutine BEGIN: called CC=1 SCAR=0.0
32 18 ▶use parent qw( Pod::POM::Node );
Subroutine BEGIN: called CC=1 SCAR=0.0
33  
34 18 our @ATTRIBS = ( text => '' );
35  
36 367 ▶sub new {
Subroutine new: called CC=4 SCAR=14.0
Pod undocumented
37 367 my $class = shift;
38 367 my $pom = shift;
39 367 my $text = shift;
40 $text = $pom->parse_sequence($text)
41 || return $class->error($pom->error())
42 367 ▶ if length $text && ! $pom->{in_begin};
Branch: 1 branch
BranchTrueFalseTotal
if length $text and not $pom->{"in_begin"} 349 18 367
Condition60%3/5
length $text and not $pom->{"in_begin"}
!ll&&!rl&&r
018349
$pom->parse_sequence($text) || (return $class->error($pom->error))
l!l
3490
MC/DC50%1/2
length $text and not $pom->{"in_begin"}
length $text not $pom->{"in_begin"}
MC/DC0%0/1
$pom->parse_sequence($text) || (return $class->error($pom->error))
$pom->parse_sequence($text)
Truth table66%2/3
A and not(B)
A= length $textB= not $pom->{"in_begin"}
ABresult
0X0
100
111
Truth table50%1/2
A
A= $pom->parse_sequence($text)
Aresult
11
00
43 367 return $class->SUPER::new($pom, $text);
44 }
45  
46 322 ▶sub add {
Subroutine add: called CC=1 SCAR=0.0
Pod undocumented
47 322 return IGNORE;
48 }
49  
50 268 ▶sub present {
Subroutine present: called CC=3 SCAR=11.0
Pod undocumented
51 268 my ($self, $view) = @_;
52 268 my $text = $self->{ text };
53 268 ▶ $view ||= $Pod::POM::DEFAULT_VIEW;
Condition66%2/3
$view ||= $Pod::POM::DEFAULT_VIEW
l!l&&r!l&&!r
26620
MC/DC0%0/2
$view ||= $Pod::POM::DEFAULT_VIEW
$view $Pod::POM::DEFAULT_VIEW
Truth table66%2/3
A ||= B
A= $viewB= $Pod::POM::DEFAULT_VIEW
ABresult
1X1
011
000
54  
55 268 ▶ $text = $text->present($view)
Branch: 1 branch
BranchTrueFalseTotal
if ref $text 259 9 268
56 if ref $text;
57  
58 268 return $view->view_textblock($text);
59 }
60  
61 18 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 E<lt>a.ford@ford-mason.co.ukE<gt>
78  
79 Andy Wardley E<lt>abw@kfs.orgE<gt>
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<Pod::POM::Node> for a discussion of nodes.
« lib/Pod/POM/Test.pm ↑ Summary blib/lib/Pod/POM/Node/Head2.pm »