File Coverage

lib/HTML/TokeParser/Simple/Token/ProcessInstruction.pm
Criterion Covered Total %
statement 10 10 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod 4 4 100.0
total 20 20 100.0


line stmt bran cond sub pod time code
1             package HTML::TokeParser::Simple::Token::ProcessInstruction;
2              
3 5     5   20 use strict;
  5         7  
  5         328  
4              
5             our $VERSION = '3.16';
6 5     5   22 use base 'HTML::TokeParser::Simple::Token';
  5         8  
  5         754  
7              
8 1     1 1 5 sub return_token0 { goto &get_token0 } # deprecated
9              
10             sub get_token0 {
11 2     2 1 9 return shift->[1];
12             }
13              
14 1     1 1 489 sub is_pi { 1 }
15              
16 1     1 1 4 sub is_process_instruction { 1 }
17              
18             1;
19              
20             __END__
21              
22             =head1 NAME
23              
24             HTML::TokeParser::Simple::Token::ProcessInstruction - Token.pm process instruction class.
25              
26             =head1 SYNOPSIS
27              
28             use HTML::TokeParser::Simple;
29             my $p = HTML::TokeParser::Simple->new( $somefile );
30              
31             while ( my $token = $p->get_token ) {
32             # This prints all text in an HTML doc (i.e., it strips the HTML)
33             next unless $token->is_text;
34             print $token->as_is;
35             }
36              
37             =head1 DESCRIPTION
38              
39             Process Instructions are from XML. This is very handy if you need to parse out
40             PHP and similar things with a parser.
41              
42             Currently, there appear to be some problems with process instructions. You can
43             override this class if you need finer grained handling of process instructions.
44              
45             C<is_pi()> and C<is_process_instruction()> both return true.
46              
47             =head1 OVERRIDDEN METHODS
48              
49             =over 4
50              
51             =item * get_token0
52              
53             =item * is_pi
54              
55             =item * is_process_instruction
56              
57             =item * return_token0
58              
59             =back
60              
61             =cut