| 1 | # | ||||||||||||||||||
| 2 | # Package Definition | ||||||||||||||||||
| 3 | # | ||||||||||||||||||
| 4 | |||||||||||||||||||
| 5 | package Text::UberText::Node; | ||||||||||||||||||
| 6 | |||||||||||||||||||
| 7 | # | ||||||||||||||||||
| 8 | # Compiler Directives | ||||||||||||||||||
| 9 | # | ||||||||||||||||||
| 10 | |||||||||||||||||||
| 11 | 6 | ▶ | use strict; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 12 | 6 | ▶ | use warnings; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 13 | |||||||||||||||||||
| 14 | # | ||||||||||||||||||
| 15 | # Global Variables | ||||||||||||||||||
| 16 | # | ||||||||||||||||||
| 17 | |||||||||||||||||||
| 18 | 6 | ▶ | use vars qw/$VERSION /; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 19 | |||||||||||||||||||
| 20 | 6 | $VERSION=0.95; | |||||||||||||||||
| 21 | |||||||||||||||||||
| 22 | # | ||||||||||||||||||
| 23 | # Methods | ||||||||||||||||||
| 24 | # | ||||||||||||||||||
| 25 | |||||||||||||||||||
| 26 | sub new | ||||||||||||||||||
| 27 | 0 | ▶ | { | ||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||
| 28 | 0 | my ($class)=shift; | |||||||||||||||||
| 29 | 0 | my ($object); | |||||||||||||||||
| 30 | 0 | $object={}; | |||||||||||||||||
| 31 | 0 | bless ($object,$class); | |||||||||||||||||
| 32 | 0 | $object->_init(@_); | |||||||||||||||||
| 33 | 0 | return $object; | |||||||||||||||||
| 34 | } | ||||||||||||||||||
| 35 | |||||||||||||||||||
| 36 | # | ||||||||||||||||||
| 37 | # Hidden Methods | ||||||||||||||||||
| 38 | # | ||||||||||||||||||
| 39 | |||||||||||||||||||
| 40 | sub _init | ||||||||||||||||||
| 41 | 0 | ▶ | { | ||||||||||||||||
|
Subroutine
_init: not called CC=6 SCAR=37.4
| |||||||||||||||||||
| 42 | 0 | my ($self)=shift; | |||||||||||||||||
| 43 | 0 | my ($x,$text,$line,$tree); | |||||||||||||||||
| 44 | 0 | ▶ | while (@_) | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 45 | { | ||||||||||||||||||
| 46 | 0 | ($x)=shift; | |||||||||||||||||
| 47 | 0 | ▶ | if ($x eq "-text") | ||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||
| 48 | { | ||||||||||||||||||
| 49 | 0 | $text=shift; | |||||||||||||||||
| 50 | } elsif ($x eq "-line") | ||||||||||||||||||
| 51 | { | ||||||||||||||||||
| 52 | 0 | $line=shift; | |||||||||||||||||
| 53 | 0 | $self->lineNumber($line); | |||||||||||||||||
| 54 | } elsif ($x eq "-tree") | ||||||||||||||||||
| 55 | { | ||||||||||||||||||
| 56 | 0 | $tree=shift; | |||||||||||||||||
| 57 | 0 | $self->tree($tree); | |||||||||||||||||
| 58 | } | ||||||||||||||||||
| 59 | } | ||||||||||||||||||
| 60 | 0 | ▶ | if ($text) | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 61 | { | ||||||||||||||||||
| 62 | 0 | $self->input($text); | |||||||||||||||||
| 63 | } | ||||||||||||||||||
| 64 | 0 | return; | |||||||||||||||||
| 65 | } | ||||||||||||||||||
| 66 | |||||||||||||||||||
| 67 | sub input | ||||||||||||||||||
| 68 | 0 | ▶ | { | ||||||||||||||||
|
Subroutine
input: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||
| 69 | 0 | my ($self)=shift; | |||||||||||||||||
| 70 | 0 | ▶ | if (@_) | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 71 | { | ||||||||||||||||||
| 72 | 0 | $self->{input}=shift; | |||||||||||||||||
| 73 | 0 | $self->process(); | |||||||||||||||||
| 74 | } | ||||||||||||||||||
| 75 | 0 | return $self->{input}; | |||||||||||||||||
| 76 | } | ||||||||||||||||||
| 77 | |||||||||||||||||||
| 78 | sub output | ||||||||||||||||||
| 79 | 0 | ▶ | { | ||||||||||||||||
|
Subroutine
output: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||
| 80 | 0 | my ($self)=shift; | |||||||||||||||||
| 81 | 0 | return $self->{output}; | |||||||||||||||||
| 82 | } | ||||||||||||||||||
| 83 | |||||||||||||||||||
| 84 | sub index | ||||||||||||||||||
| 85 | 0 | ▶ | { | ||||||||||||||||
|
Subroutine
index: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||
| 86 | 0 | my ($self)=shift; | |||||||||||||||||
| 87 | 0 | ▶ | if (@_) | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 88 | { | ||||||||||||||||||
| 89 | 0 | $self->{index}=shift; | |||||||||||||||||
| 90 | } | ||||||||||||||||||
| 91 | 0 | return $self->{index}; | |||||||||||||||||
| 92 | } | ||||||||||||||||||
| 93 | |||||||||||||||||||
| 94 | sub parent | ||||||||||||||||||
| 95 | 0 | ▶ | { | ||||||||||||||||
|
Subroutine
parent: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||
| 96 | 0 | my ($self)=shift; | |||||||||||||||||
| 97 | 0 | ▶ | if (@_) | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 98 | { | ||||||||||||||||||
| 99 | 0 | $self->{parent}=shift; | |||||||||||||||||
| 100 | } | ||||||||||||||||||
| 101 | 0 | return $self->{parent}; | |||||||||||||||||
| 102 | } | ||||||||||||||||||
| 103 | |||||||||||||||||||
| 104 | sub lineNumber | ||||||||||||||||||
| 105 | 0 | ▶ | { | ||||||||||||||||
|
Subroutine
lineNumber: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||
| 106 | 0 | my ($self)=shift; | |||||||||||||||||
| 107 | 0 | ▶ | if (@_) | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 108 | { | ||||||||||||||||||
| 109 | 0 | $self->{linenum}=shift; | |||||||||||||||||
| 110 | } | ||||||||||||||||||
| 111 | 0 | return $self->{linenum}; | |||||||||||||||||
| 112 | } | ||||||||||||||||||
| 113 | |||||||||||||||||||
| 114 | sub class | ||||||||||||||||||
| 115 | 0 | ▶ | { | ||||||||||||||||
|
Subroutine
class: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||
| 116 | 0 | my ($self)=shift; | |||||||||||||||||
| 117 | 0 | my ($class)=ref($self); | |||||||||||||||||
| 118 | 0 | my (@c); | |||||||||||||||||
| 119 | 0 | (@c)=split(/::/,$class); | |||||||||||||||||
| 120 | 0 | ($class)=pop(@c); | |||||||||||||||||
| 121 | 0 | return $class; | |||||||||||||||||
| 122 | } | ||||||||||||||||||
| 123 | |||||||||||||||||||
| 124 | sub process | ||||||||||||||||||
| 125 | 0 | ▶ | { | ||||||||||||||||
|
Subroutine
process: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||
| 126 | 0 | my ($self)=shift; | |||||||||||||||||
| 127 | |||||||||||||||||||
| 128 | 0 | return; | |||||||||||||||||
| 129 | } | ||||||||||||||||||
| 130 | |||||||||||||||||||
| 131 | sub inserted | ||||||||||||||||||
| 132 | 0 | ▶ | { | ||||||||||||||||
|
Subroutine
inserted: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||
| 133 | 0 | my ($self)=shift; | |||||||||||||||||
| 134 | # $self->process(); | ||||||||||||||||||
| 135 | 0 | return; | |||||||||||||||||
| 136 | } | ||||||||||||||||||
| 137 | |||||||||||||||||||
| 138 | sub info | ||||||||||||||||||
| 139 | 0 | ▶ | { | ||||||||||||||||
|
Subroutine
info: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||
| 140 | 0 | my ($self)=shift; | |||||||||||||||||
| 141 | |||||||||||||||||||
| 142 | 0 | return; | |||||||||||||||||
| 143 | } | ||||||||||||||||||
| 144 | |||||||||||||||||||
| 145 | sub run | ||||||||||||||||||
| 146 | 0 | ▶ | { | ||||||||||||||||
|
Subroutine
run: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||
| 147 | 0 | my ($self)=shift; | |||||||||||||||||
| 148 | |||||||||||||||||||
| 149 | 0 | return; | |||||||||||||||||
| 150 | } | ||||||||||||||||||
| 151 | |||||||||||||||||||
| 152 | sub tree | ||||||||||||||||||
| 153 | 0 | ▶ | { | ||||||||||||||||
|
Subroutine
tree: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||
| 154 | 0 | my ($self)=shift; | |||||||||||||||||
| 155 | 0 | ▶ | if (@_) | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 156 | { | ||||||||||||||||||
| 157 | 0 | $self->{tree}=shift; | |||||||||||||||||
| 158 | } | ||||||||||||||||||
| 159 | 0 | return $self->{tree}; | |||||||||||||||||
| 160 | } | ||||||||||||||||||
| 161 | |||||||||||||||||||
| 162 | # | ||||||||||||||||||
| 163 | # Exit Block | ||||||||||||||||||
| 164 | # | ||||||||||||||||||
| 165 | 6 | 1; | |||||||||||||||||
| 166 | |||||||||||||||||||
| 167 | # | ||||||||||||||||||
| 168 | # POD Documentation | ||||||||||||||||||
| 169 | # | ||||||||||||||||||
| 170 | |||||||||||||||||||
| 171 | =head1 NAME | ||||||||||||||||||
| 172 | |||||||||||||||||||
| 173 | Text::UberText::Node - Superclass Node Object | ||||||||||||||||||
| 174 | |||||||||||||||||||
| 175 | =head1 DESCRIPTION | ||||||||||||||||||
| 176 | |||||||||||||||||||
| 177 | Text::UberText::Node is a super-class for the L<Text::UberText::Node::Text> and | ||||||||||||||||||
| 178 | L<Text::UberText::Node::Command> classes. The methods listed below are | ||||||||||||||||||
| 179 | implemented in both subclasses. The POD documentation for both classes only | ||||||||||||||||||
| 180 | lists methods that are unique to the particular module, or methods that have | ||||||||||||||||||
| 181 | different bahavior from the methods listed below. | ||||||||||||||||||
| 182 | |||||||||||||||||||
| 183 | =head1 COMMON METHODS | ||||||||||||||||||
| 184 | |||||||||||||||||||
| 185 | =over 4 | ||||||||||||||||||
| 186 | |||||||||||||||||||
| 187 | =item $node=Text::UberText::Node->new(); | ||||||||||||||||||
| 188 | |||||||||||||||||||
| 189 | Creates a new node object. | ||||||||||||||||||
| 190 | |||||||||||||||||||
| 191 | =item $node->input($string); | ||||||||||||||||||
| 192 | |||||||||||||||||||
| 193 | Text string to be processed by the node. | ||||||||||||||||||
| 194 | |||||||||||||||||||
| 195 | =item $text=$node->output(); | ||||||||||||||||||
| 196 | |||||||||||||||||||
| 197 | Output generated after the node has been processed and run | ||||||||||||||||||
| 198 | |||||||||||||||||||
| 199 | =item $node->process(); | ||||||||||||||||||
| 200 | |||||||||||||||||||
| 201 | Parsing and examination of the node input, completed before it is | ||||||||||||||||||
| 202 | actually run. | ||||||||||||||||||
| 203 | |||||||||||||||||||
| 204 | =item $node->run(); | ||||||||||||||||||
| 205 | |||||||||||||||||||
| 206 | Process external commands using data from the node object. | ||||||||||||||||||
| 207 | |||||||||||||||||||
| 208 | =item $node->info(); | ||||||||||||||||||
| 209 | |||||||||||||||||||
| 210 | Returns information on the data within the node | ||||||||||||||||||
| 211 | |||||||||||||||||||
| 212 | =item $node->tree(); | ||||||||||||||||||
| 213 | |||||||||||||||||||
| 214 | Returns the $tree object that created the node. | ||||||||||||||||||
| 215 | |||||||||||||||||||
| 216 | =item $node->index(); | ||||||||||||||||||
| 217 | |||||||||||||||||||
| 218 | Returns the tree index pointer for the node. | ||||||||||||||||||
| 219 | |||||||||||||||||||
| 220 | =item $node->class(); | ||||||||||||||||||
| 221 | |||||||||||||||||||
| 222 | Returns the lest segment of the Perl class for the node. For example, if | ||||||||||||||||||
| 223 | the actual class is "Text::UberText::Node::Command:, "Command" is returned. | ||||||||||||||||||
| 224 | |||||||||||||||||||
| 225 | =item $node->lineNumber(); | ||||||||||||||||||
| 226 | |||||||||||||||||||
| 227 | Returns the line number of the source input that the node text started on. | ||||||||||||||||||
| 228 | |||||||||||||||||||
| 229 | =back | ||||||||||||||||||
| 230 | |||||||||||||||||||
| 231 | =head1 AUTHOR | ||||||||||||||||||
| 232 | |||||||||||||||||||
| 233 | Chris Josephes E<lt>cpj1@visi.comE<gt> | ||||||||||||||||||
| 234 | |||||||||||||||||||
| 235 | =head1 SEE ALSO | ||||||||||||||||||
| 236 | |||||||||||||||||||
| 237 | L<Text::UberText::Node::Command>, | ||||||||||||||||||
| 238 | L<Text::UberText::Node::Text> | ||||||||||||||||||
| 239 | |||||||||||||||||||
| 240 | =head1 COPYRIGHT | ||||||||||||||||||
| 241 | |||||||||||||||||||
| 242 | Copyright 2002, Chris Josephes. All rights reserved. | ||||||||||||||||||
| 243 | This module is free software. It may be used, redistributed, | ||||||||||||||||||
| 244 | and/or modified under the same terms as Perl itself. | ||||||||||||||||||
| 245 | ~ | ||||||||||||||||||