1
2require 5;
3package Pod::Simple::PullParserTextToken;
4use Pod::Simple::PullParserToken ();
5use strict;
6use vars qw(@ISA $VERSION);
7@ISA = ('Pod::Simple::PullParserToken');
8$VERSION = '3.14';
9
10sub new {  # Class->new(text);
11  my $class = shift;
12  return bless ['text', @_], ref($class) || $class;
13}
14
15# Purely accessors:
16
17sub text { (@_ == 2) ? ($_[0][1] = $_[1]) : $_[0][1] }
18
19sub text_r { \ $_[0][1] }
20
211;
22
23__END__
24
25=head1 NAME
26
27Pod::Simple::PullParserTextToken -- text-tokens from Pod::Simple::PullParser
28
29=head1 SYNOPSIS
30
31(See L<Pod::Simple::PullParser>)
32
33=head1 DESCRIPTION
34
35When you do $parser->get_token on a L<Pod::Simple::PullParser>, you might
36get an object of this class.
37
38This is a subclass of L<Pod::Simple::PullParserToken> and inherits all its methods,
39and adds these methods:
40
41=over
42
43=item $token->text
44
45This returns the text that this token holds.  For example, parsing
46CZ<><foo> will return a C start-token, a text-token, and a C end-token.  And
47if you want to get the "foo" out of the text-token, call C<< $token->text >>
48
49=item $token->text(I<somestring>)
50
51This changes the string that this token holds.  You probably won't need
52to do this.
53
54=item $token->text_r()
55
56This returns a scalar reference to the string that this token holds.
57This can be useful if you don't want to memory-copy the potentially
58large text value (well, as large as a paragraph or a verbatim block)
59as calling $token->text would do.
60
61Or, if you want to alter the value, you can even do things like this:
62
63  for ( ${  $token->text_r  } ) {  # Aliases it with $_ !!
64
65    s/ The / the /g; # just for example
66
67    if( 'A' eq chr(65) ) {  # (if in an ASCII world)
68      tr/\xA0/ /;
69      tr/\xAD//d;
70    }
71
72    ...or however you want to alter the value...
73  }
74
75=back
76
77You're unlikely to ever need to construct an object of this class for
78yourself, but if you want to, call
79C<<
80Pod::Simple::PullParserTextToken->new( I<text> )
81>>
82
83=head1 SEE ALSO
84
85L<Pod::Simple::PullParserToken>, L<Pod::Simple>, L<Pod::Simple::Subclassing>
86
87=head1 SUPPORT
88
89Questions or discussion about POD and Pod::Simple should be sent to the
90pod-people@perl.org mail list. Send an empty email to
91pod-people-subscribe@perl.org to subscribe.
92
93This module is managed in an open GitHub repository,
94L<http://github.com/theory/pod-simple/>. Feel free to fork and contribute, or
95to clone L<git://github.com/theory/pod-simple.git> and send patches!
96
97Patches against Pod::Simple are welcome. Please send bug reports to
98<bug-pod-simple@rt.cpan.org>.
99
100=head1 COPYRIGHT AND DISCLAIMERS
101
102Copyright (c) 2002 Sean M. Burke.
103
104This library is free software; you can redistribute it and/or modify it
105under the same terms as Perl itself.
106
107This program is distributed in the hope that it will be useful, but
108without any warranty; without even the implied warranty of
109merchantability or fitness for a particular purpose.
110
111=head1 AUTHOR
112
113Pod::Simple was created by Sean M. Burke <sburke@cpan.org>.
114But don't bother him, he's retired.
115
116Pod::Simple is maintained by:
117
118=over
119
120=item * Allison Randal C<allison@perl.org>
121
122=item * Hans Dieter Pearcey C<hdp@cpan.org>
123
124=item * David E. Wheeler C<dwheeler@cpan.org>
125
126=back
127
128=cut
129