File Coverage

blib/lib/Pod/POM/Node/Sequence.pm
Criterion Covered Total %
statement 28 29 96.5
branch 5 6 83.3
condition 3 6 50.0
subroutine 6 7 85.7
pod 0 3 0.0
total 42 51 82.3


line stmt bran cond sub pod time code
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
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: Sequence.pm 89 2013-05-30 07:41:52Z ford $
22             #
23             #========================================================================
24              
25             package Pod::POM::Node::Sequence;
26             $Pod::POM::Node::Sequence::VERSION = '2.01';
27             require 5.006;
28 18     18   82 use strict;
  18         31  
  18         455  
29 18     18   87 use warnings;
  18         28  
  18         530  
30              
31 18     18   91 use Pod::POM::Constants qw( :all );
  18         23  
  18         2407  
32 18     18   82 use parent qw( Pod::POM::Node );
  18         44  
  18         96  
33              
34             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             sub new {
47 832     832 0 1355 my ($class, $self) = @_;
48 832         1202 local $" = '] [';
49 832         4274 return bless \$self, $class;
50             }
51              
52             sub add {
53 0     0 0 0 return IGNORE;
54             }
55              
56             sub present {
57 668     668 0 956 my ($self, $view) = @_;
58 668         736 my ($cmd, $method, $result);
59 668   66     1245 $view ||= $Pod::POM::DEFAULT_VIEW;
60              
61 668         854 $self = $$self;
62 668 50       1441 return $self unless ref $self eq 'ARRAY';
63              
64             my $text = join('',
65 976 100       4316 map { ref $_ ? $_->present($view)
66             : $view->view_seq_text($_) }
67 668         778 @{ $self->[CONTENT] });
  668         1292  
68            
69 668 100       1656 if ($cmd = $self->[CMD]) {
70 165   33     464 my $method = $NAME{ $cmd } || $cmd;
71 165         269 $method = "view_seq_$method";
72 165         765 return $view->$method($text);
73             }
74             else {
75 503         1651 return $text;
76             }
77             }
78              
79             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 Ea.ford@ford-mason.co.ukE
96              
97             Andy Wardley Eabw@kfs.orgE
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 for a discussion of nodes.