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

filter: Statementstmt 96.9% 32 / 33 Branchbran 83.3% 5 / 6 Conditioncond 50.0% 3 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 85.7% 6 / 7 Podpod 0.0% 0 / 3 totaltotal 77.9% 46 / 59 CC 6 SCAR 13.0
CC
6
Cov
89%
present
6.1
add
2.0
BEGIN
1.0
CRAP 3.7
« blib/lib/Pod/POM/View.pm ↑ Summary blib/lib/Pod/POM/View/Text.pm »
1 #============================================================= -*-Perl-*-
2 #
3 # Pod::POM::Node::Sequence
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: Sequence.pm 89 2013-05-30 07:41:52Z ford $
22 #
23 #========================================================================
24  
25 package Pod::POM::Node::Sequence;
26 18 $Pod::POM::Node::Sequence::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 %NAME = (
35 C => 'code',
36 B => 'bold',
37 I => 'italic',
38 L => 'link',
39 S => 'space',
40 F => 'file',
41 X => 'index',
42 Z => 'zero',
43 E => 'entity',
44 );
45
46 832 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
47 832 my ($class, $self) = @_;
48 832 local $" = '] [';
49 832 return bless \$self, $class;
50 }
51  
52 0 ▶sub add {
Subroutine add: not called CC=1 SCAR=6.9
Pod undocumented
53 0 return IGNORE;
54 }
55  
56 668 ▶sub present {
Subroutine present: called CC=6 SCAR=18.2
Pod undocumented
57 668 my ($self, $view) = @_;
58 668 my ($cmd, $method, $result);
59 668 ▶ $view ||= $Pod::POM::DEFAULT_VIEW;
Condition66%2/3
$view ||= $Pod::POM::DEFAULT_VIEW
l!l&&r!l&&!r
647210
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
60  
61 668 $self = $$self;
62 668 ▶ return $self unless ref $self eq 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $self eq "ARRAY" 0 668 668
63  
64 my $text = join('',
65 976 ▶ map { ref $_ ? $_->present($view)
Branch: 1 branch
BranchTrueFalseTotal
ref $_ ? : 165 811 976
66 : $view->view_seq_text($_) }
67 668 @{ $self->[CONTENT] });
68
69 668 ▶ if ($cmd = $self->[CMD]) {
Branch: 1 branch
BranchTrueFalseTotal
if ($cmd = $self->[0]) { } 165 503 668
70 165 ▶ my $method = $NAME{ $cmd } || $cmd;
Condition33%1/3
$Pod::POM::Node::Sequence::NAME{$cmd} || $cmd
l!l&&r!l&&!r
16500
MC/DC0%0/2
$Pod::POM::Node::Sequence::NAME{$cmd} || $cmd
$Pod::POM::Node::Sequence::NAME{$cmd} $cmd
Truth table33%1/3
A || B
A= $Pod::POM::Node::Sequence::NAME{$cmd}B= $cmd
ABresult
1X1
011
000
71 165 $method = "view_seq_$method";
72 165 return $view->$method($text);
73 }
74 else {
75 503 return $text;
76 }
77 }
78  
79 18 1;
80  
81 =head1 NAME
82  
83 Pod::POM::Node::Sequence -
84  
85 =head1 SYNOPSIS
86  
87 use Pod::POM::Nodes;
88  
89 =head1 DESCRIPTION
90  
91 This module implements a specialization of the node class to represent sequence elements.
92  
93 =head1 AUTHOR
94  
95 Andrew Ford E<lt>a.ford@ford-mason.co.ukE<gt>
96  
97 Andy Wardley E<lt>abw@kfs.orgE<gt>
98  
99 =head1 COPYRIGHT
100  
101 Copyright (C) 2000, 2001 Andy Wardley. All Rights Reserved.
102  
103 Copyright (C) 2009 Andrew Ford. All Rights Reserved.
104  
105 This module is free software; you can redistribute it and/or
106 modify it under the same terms as Perl itself.
107  
108 =head1 SEE ALSO
109  
110 Consult L<Pod::POM::Node> for a discussion of nodes.
« blib/lib/Pod/POM/View.pm ↑ Summary blib/lib/Pod/POM/View/Text.pm »