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