Text.pm
Go to the documentation of this file.
00001 #============================================================= -*-Perl-*- 00002 # 00003 # Pod::POM::Node::Text 00004 # 00005 # DESCRIPTION 00006 # Module implementing specific nodes in a Pod::POM, subclassed from 00007 # Pod::POM::Node. 00008 # 00009 # AUTHOR 00010 # Andy Wardley <abw@kfs.org> 00011 # Andrew Ford <a.ford@ford-mason.co.uk> 00012 # 00013 # COPYRIGHT 00014 # Copyright (C) 2000, 2001 Andy Wardley. All Rights Reserved. 00015 # Copyright (C) 2009 Andrew Ford. All Rights Reserved. 00016 # 00017 # This module is free software; you can redistribute it and/or 00018 # modify it under the same terms as Perl itself. 00019 # 00020 # REVISION 00021 # $Id: Text.pm 76 2009-08-20 20:41:33Z ford $ 00022 # 00023 #======================================================================== 00024 00025 package BASIS::Pod::POM::Node::Text; 00026 00027 use strict; 00028 00029 use BASIS::Pod::POM::Constants qw( :all ); 00030 use parent qw( BASIS::Pod::POM::Node ); 00031 use vars qw( %ATTRIBS $ERROR ); 00032 00033 %ATTRIBS = ( text => '' ); 00034 00035 sub new { 00036 my $class = shift; 00037 my $pom = shift; 00038 my $text = shift; 00039 $text = $pom->parse_sequence($text) 00040 || return $class->error($pom->error()) 00041 if length $text && ! $pom->{in_begin}; 00042 return $class->SUPER::new($pom, $text); 00043 } 00044 00045 sub add { 00046 return IGNORE; 00047 } 00048 00049 sub present { 00050 my ($self, $view) = @_; 00051 my $text = $self->{ text }; 00052 $view ||= $BASIS::Pod::POM::DEFAULT_VIEW; 00053 00054 $text = $text->present($view) 00055 if ref $text; 00056 00057 return $view->view_textblock($text); 00058 } 00059 00060 1; 00061 00062 =head1 NAME 00063 00064 Pod::POM::Node::Text - 00065 00066 =head1 SYNOPSIS 00067 00068 use Pod::POM::Nodes; 00069 00070 =head1 DESCRIPTION 00071 00072 This module implements a specialization of the node class to represent text elements. 00073 00074 =head1 AUTHOR 00075 00076 Andrew Ford E<lt>a.ford@ford-mason.co.ukE<gt> 00077 00078 Andy Wardley E<lt>abw@kfs.orgE<gt> 00079 00080 =head1 COPYRIGHT 00081 00082 Copyright (C) 2000, 2001 Andy Wardley. All Rights Reserved. 00083 00084 Copyright (C) 2009 Andrew Ford. All Rights Reserved. 00085 00086 This module is free software; you can redistribute it and/or 00087 modify it under the same terms as Perl itself. 00088 00089 =head1 SEE ALSO 00090 00091 Consult L<Pod::POM::Node> for a discussion of nodes.