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
25package Pod::POM::Node::Sequence;
26$Pod::POM::Node::Sequence::VERSION = '2.01';
27require 5.006;
28use strict;
29use warnings;
30
31use Pod::POM::Constants qw( :all );
32use parent qw( Pod::POM::Node );
33
34our %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
46sub new {
47    my ($class, $self) = @_;
48    local $" = '] [';
49    return bless \$self, $class;
50}
51
52sub add {
53    return IGNORE;
54}
55
56sub present {
57    my ($self, $view) = @_;
58    my ($cmd, $method, $result);
59    $view ||= $Pod::POM::DEFAULT_VIEW;
60
61    $self = $$self;
62    return $self unless ref $self eq 'ARRAY';
63
64    my $text = join('',
65                    map { ref $_ ? $_->present($view)
66                                 : $view->view_seq_text($_) }
67                    @{ $self->[CONTENT] });
68
69    if ($cmd = $self->[CMD]) {
70        my $method = $NAME{ $cmd } || $cmd;
71        $method = "view_seq_$method";
72        return $view->$method($text);
73    }
74    else {
75        return $text;
76    }
77}
78
791;
80
81=head1 NAME
82
83Pod::POM::Node::Sequence -
84
85=head1 SYNOPSIS
86
87    use Pod::POM::Nodes;
88
89=head1 DESCRIPTION
90
91This module implements a specialization of the node class to represent sequence elements.
92
93=head1 AUTHOR
94
95Andrew Ford E<lt>a.ford@ford-mason.co.ukE<gt>
96
97Andy Wardley E<lt>abw@kfs.orgE<gt>
98
99=head1 COPYRIGHT
100
101Copyright (C) 2000, 2001 Andy Wardley.  All Rights Reserved.
102
103Copyright (C) 2009 Andrew Ford.  All Rights Reserved.
104
105This module is free software; you can redistribute it and/or
106modify it under the same terms as Perl itself.
107
108=head1 SEE ALSO
109
110Consult L<Pod::POM::Node> for a discussion of nodes.
111