Commit | Line | Data |
351625bd |
1 | |
2 | require 5; |
3 | package Pod::Simple::PullParserEndToken; |
4 | use Pod::Simple::PullParserToken (); |
5 | @ISA = ('Pod::Simple::PullParserToken'); |
6 | use strict; |
7 | |
8 | sub new { # Class->new(tagname); |
9 | my $class = shift; |
10 | return bless ['end', @_], ref($class) || $class; |
11 | } |
12 | |
13 | # Purely accessors: |
14 | |
15 | sub tagname { (@_ == 2) ? ($_[0][1] = $_[1]) : $_[0][1] } |
16 | sub tag { shift->tagname(@_) } |
17 | |
18 | # shortcut: |
19 | sub is_tagname { $_[0][1] eq $_[1] } |
20 | sub is_tag { shift->is_tagname(@_) } |
21 | |
22 | 1; |
23 | |
24 | |
25 | __END__ |
26 | |
27 | =head1 NAME |
28 | |
29 | Pod::Simple::PullParserEndToken -- end-tokens from Pod::Simple::PullParser |
30 | |
31 | =head1 SYNOPSIS |
32 | |
33 | (See L<Pod::Simple::PullParser>) |
34 | |
35 | =head1 DESCRIPTION |
36 | |
37 | When you do $parser->get_token on a L<Pod::Simple::PullParser>, you might |
38 | get an object of this class. |
39 | |
40 | This is a subclass of L<Pod::Simple::PullParserToken> and inherits all its methods, |
41 | and adds these methods: |
42 | |
43 | =over |
44 | |
45 | =item $token->tagname |
46 | |
47 | This returns the tagname for this end-token object. |
48 | For example, parsing a "=head1 ..." line will give you |
49 | a start-token with the tagname of "head1", token(s) for its |
50 | content, and then an end-token with the tagname of "head1". |
51 | |
52 | =item $token->tagname(I<somestring>) |
53 | |
54 | This changes the tagname for this end-token object. |
55 | You probably won't need to do this. |
56 | |
57 | =item $token->tag(...) |
58 | |
59 | A shortcut for $token->tagname(...) |
60 | |
61 | =item $token->is_tag(I<somestring>) or $token->is_tagname(I<somestring>) |
62 | |
63 | These are shortcuts for C<< $token->tag() eq I<somestring> >> |
64 | |
65 | =back |
66 | |
67 | You're unlikely to ever need to construct an object of this class for |
68 | yourself, but if you want to, call |
69 | C<< |
70 | Pod::Simple::PullParserEndToken->new( I<tagname> ) |
71 | >> |
72 | |
73 | =head1 SEE ALSO |
74 | |
75 | L<Pod::Simple::PullParserToken>, L<Pod::Simple>, L<Pod::Simple::Subclassing> |
76 | |
77 | =head1 COPYRIGHT AND DISCLAIMERS |
78 | |
79 | Copyright (c) 2002 Sean M. Burke. All rights reserved. |
80 | |
81 | This library is free software; you can redistribute it and/or modify it |
82 | under the same terms as Perl itself. |
83 | |
84 | This program is distributed in the hope that it will be useful, but |
85 | without any warranty; without even the implied warranty of |
86 | merchantability or fitness for a particular purpose. |
87 | |
88 | =head1 AUTHOR |
89 | |
90 | Sean M. Burke C<sburke@cpan.org> |
91 | |
92 | =cut |
93 | |