|  line  | 
 stmt  | 
 bran  | 
 cond  | 
 sub  | 
 pod  | 
 time  | 
 code  | 
| 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 package HTML::DTD;  | 
| 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
3
 | 
4
 | 
 
 | 
 
 | 
  
4
  
 | 
 
 | 
75170
 | 
 use strict;  | 
| 
 
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
11
 | 
    | 
| 
 
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
160
 | 
    | 
| 
4
 | 
4
 | 
 
 | 
 
 | 
  
4
  
 | 
 
 | 
24
 | 
 use warnings;  | 
| 
 
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
9
 | 
    | 
| 
 
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
124
 | 
    | 
| 
5
 | 
4
 | 
 
 | 
 
 | 
  
4
  
 | 
 
 | 
21
 | 
 no warnings "uninitialized";  | 
| 
 
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
12
 | 
    | 
| 
 
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
158
 | 
    | 
| 
6
 | 
4
 | 
 
 | 
 
 | 
  
4
  
 | 
 
 | 
22
 | 
 use Scalar::Util qw( blessed );  | 
| 
 
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
8
 | 
    | 
| 
 
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
441
 | 
    | 
| 
7
 | 
4
 | 
 
 | 
 
 | 
  
4
  
 | 
 
 | 
24
 | 
 use Carp qw( carp confess croak );  | 
| 
 
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
8
 | 
    | 
| 
 
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
260
 | 
    | 
| 
8
 | 
4
 | 
 
 | 
 
 | 
  
4
  
 | 
 
 | 
4083
 | 
 use File::ShareDir ();  | 
| 
 
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
33227
 | 
    | 
| 
 
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
102
 | 
    | 
| 
9
 | 
4
 | 
 
 | 
 
 | 
  
4
  
 | 
 
 | 
4302
 | 
 use Path::Class;  | 
| 
 
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
221943
 | 
    | 
| 
 
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
2177
 | 
    | 
| 
10
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
11
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 our $VERSION = "0.04";  | 
| 
12
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
13
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub new : method {  | 
| 
14
 | 
2
 | 
 
 | 
 
 | 
  
2
  
 | 
  
1
  
 | 
21
 | 
     my $caller = shift;  | 
| 
15
 | 
2
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
12
 | 
     croak "No arguments allowed to new()" if @_;  | 
| 
16
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
5
 | 
     my $holder = "";  | 
| 
17
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
23
 | 
     return bless \$holder, $caller;  | 
| 
18
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
19
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
20
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub dtds : method {  | 
| 
21
 | 
4
 | 
 
 | 
 
 | 
  
4
  
 | 
  
1
  
 | 
102
 | 
     my $caller = shift;  | 
| 
22
 | 
4
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
21
 | 
     croak "No arguments allowed to dtds()" if @_;  | 
| 
23
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
22
 | 
     my $dir = Path::Class::Dir->new( File::ShareDir::dist_dir("HTML-DTD") );  | 
| 
24
 | 
4
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
1109
 | 
     opendir my $dh, $dir or die "Could not open '$dir' for reading: $!";  | 
| 
25
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
1884
 | 
     return sort grep /\.dtd\z/, readdir $dh;  | 
| 
26
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
27
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
28
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub get_dtd_fh {  | 
| 
29
 | 
60
 | 
 
 | 
 
 | 
  
60
  
 | 
  
1
  
 | 
96
 | 
     my $arg = shift;  | 
| 
30
 | 
60
 | 
  
100
  
 | 
  
100
  
 | 
 
 | 
 
 | 
396
 | 
     my $dtd = shift if $arg eq __PACKAGE__ or blessed($arg) eq __PACKAGE__;  | 
| 
31
 | 
60
 | 
 
 | 
  
 66
  
 | 
 
 | 
 
 | 
162
 | 
     $dtd ||= $arg;  | 
| 
32
 | 
60
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
131
 | 
     croak "DTD name required" unless $dtd;  | 
| 
33
 | 
60
 | 
 
 | 
 
 | 
 
 | 
 
 | 
216
 | 
     my $file = File::ShareDir::dist_file("HTML-DTD", $dtd);  | 
| 
34
 | 
60
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
14167
 | 
     open my $fh, "<", $file or croak "Could not open '$file' for reading: $!";  | 
| 
35
 | 
60
 | 
 
 | 
 
 | 
 
 | 
 
 | 
350
 | 
     return $fh;  | 
| 
36
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
37
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
38
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub get_dtd_path {  | 
| 
39
 | 
60
 | 
 
 | 
 
 | 
  
60
  
 | 
  
1
  
 | 
120
 | 
     my $arg = shift;  | 
| 
40
 | 
60
 | 
  
100
  
 | 
  
100
  
 | 
 
 | 
 
 | 
384
 | 
     my $dtd = shift if $arg eq __PACKAGE__ or blessed($arg) eq __PACKAGE__;  | 
| 
41
 | 
60
 | 
 
 | 
  
 66
  
 | 
 
 | 
 
 | 
157
 | 
     $dtd ||= $arg;  | 
| 
42
 | 
60
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
120
 | 
     croak "DTD name required" unless $dtd;  | 
| 
43
 | 
60
 | 
 
 | 
 
 | 
 
 | 
 
 | 
173
 | 
     return Path::Class::File->new( File::ShareDir::dist_file("HTML-DTD", $dtd) );  | 
| 
44
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
45
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
46
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub get_dtd {  | 
| 
47
 | 
63
 | 
 
 | 
 
 | 
  
63
  
 | 
  
1
  
 | 
48341
 | 
     my $arg = shift;  | 
| 
48
 | 
63
 | 
  
100
  
 | 
  
100
  
 | 
 
 | 
 
 | 
456
 | 
     my $dtd = shift if $arg eq __PACKAGE__ or blessed($arg) eq __PACKAGE__;  | 
| 
49
 | 
63
 | 
 
 | 
  
 66
  
 | 
 
 | 
 
 | 
164
 | 
     $dtd ||= $arg;  | 
| 
50
 | 
63
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
112
 | 
     croak "DTD name required" unless $dtd;  | 
| 
51
 | 
63
 | 
 
 | 
 
 | 
 
 | 
 
 | 
187
 | 
     my $file = File::ShareDir::dist_file("HTML-DTD", $dtd);  | 
| 
52
 | 
63
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
18168
 | 
     open my $fh, "<", $file or croak "Could not open '$file' for reading: $!";  | 
| 
53
 | 
63
 | 
 
 | 
 
 | 
 
 | 
 
 | 
412
 | 
     local $/ = undef;  | 
| 
54
 | 
63
 | 
 
 | 
 
 | 
 
 | 
 
 | 
4042
 | 
     my $raw = <$fh>;  | 
| 
55
 | 
63
 | 
 
 | 
 
 | 
 
 | 
 
 | 
1016
 | 
     close $fh;  | 
| 
56
 | 
63
 | 
 
 | 
 
 | 
 
 | 
 
 | 
866
 | 
     return $raw;  | 
| 
57
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
58
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
59
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 1;  | 
| 
60
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
61
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 __END__  |