source: gs2-extensions/parallel-building/trunk/src/perllib/cpan/HTML/TokeParser/Simple/Token/Tag.pm@ 24626

Last change on this file since 24626 was 24626, checked in by jmt12, 13 years ago

An (almost) complete copy of the perllib directory from a (circa SEP2011) head checkout from Greenstone 2 trunk - in order to try and make merging in this extension a little easier later on (as there have been some major changes to buildcol.pl commited in the main trunk but not in the x64 branch)

File size: 1.7 KB
Line 
1package HTML::TokeParser::Simple::Token::Tag;
2
3use strict;
4
5use vars qw/ $VERSION $REVISION /;
6$REVISION = '$Id: Tag.pm 13983 2007-03-15 01:32:44Z lh92 $';
7$VERSION = '1.2';
8use base 'HTML::TokeParser::Simple::Token';
9
10my %INSTANCE;
11
12sub new {
13 my ($class, $object) = @_;
14 $class->_croak("This is a base class that should not be instantiated")
15 if __PACKAGE__ eq $class;
16 my $self = bless $object, $class;
17 $self->_init;
18}
19
20sub _get_attrseq { return [] }
21
22sub _get_attr { return {} }
23
24sub _set_text {
25 my $self = shift;
26 $self->[-1] = shift;
27 return $self;
28}
29
30# attribute munging methods
31# get_foo methods
32
33sub return_text {
34 carp('return_text() is deprecated. Use as_is() instead');
35 goto &as_is;
36}
37
38sub as_is {
39 return shift->_get_text;
40}
41
42sub get_tag {
43 return shift->_get_tag;
44}
45
461;
47
48__END__
49
50=head1 NAME
51
52HTML::TokeParser::Simple::Token::Tag - Token.pm tag class.
53
54=head1 SYNOPSIS
55
56 use HTML::TokeParser::Simple;
57 my $p = HTML::TokeParser::Simple->new( $somefile );
58
59 while ( my $token = $p->get_token ) {
60 # This prints all text in an HTML doc (i.e., it strips the HTML)
61 next unless $token->is_text;
62 print $token->as_is;
63 }
64
65=head1 DESCRIPTION
66
67This is the base class for start and end tokens. It should not be
68instantiated. See C<HTML::TokeParser::Simple::Token::Tag::Start> and
69C<HTML::TokeParser::Simple::Token::Tag::End> for details.
70
71=head1 OVERRIDDEN METHODS
72
73The following list of methods are provided by this class. See
74L<HTML::TokeParser::Simple> for descriptions of these methods.
75
76=over 4
77
78=item * as_is
79
80=item * get_tag
81
82=item * return_text
83
84=back
Note: See TracBrowser for help on using the repository browser.