File Coverage

blib/lib/XML/SAX/DocumentLocator.pm
Criterion Covered Total %
statement 10 37 27.0
branch 0 16 0.0
condition n/a
subroutine 3 10 30.0
pod 0 1 0.0
total 13 64 20.3


line stmt bran cond sub pod time code
1             # $Id$
2              
3             package XML::SAX::DocumentLocator;
4 12     12   66 use strict;
  12         36  
  12         7577  
5              
6             sub new {
7 22     22 0 44 my $class = shift;
8 22         36 my %object;
9 22         136 tie %object, $class, @_;
10              
11 22         210 return bless \%object, $class;
12             }
13              
14             sub TIEHASH {
15 22     22   40 my $class = shift;
16 22         51 my ($pubmeth, $sysmeth, $linemeth, $colmeth, $encmeth, $xmlvmeth) = @_;
17 22         209 return bless {
18             pubmeth => $pubmeth,
19             sysmeth => $sysmeth,
20             linemeth => $linemeth,
21             colmeth => $colmeth,
22             encmeth => $encmeth,
23             xmlvmeth => $xmlvmeth,
24             }, $class;
25             }
26              
27             sub FETCH {
28 0     0     my ($self, $key) = @_;
29 0           my $method;
30 0 0         if ($key eq 'PublicId') {
    0          
    0          
    0          
    0          
    0          
31 0           $method = $self->{pubmeth};
32             }
33             elsif ($key eq 'SystemId') {
34 0           $method = $self->{sysmeth};
35             }
36             elsif ($key eq 'LineNumber') {
37 0           $method = $self->{linemeth};
38             }
39             elsif ($key eq 'ColumnNumber') {
40 0           $method = $self->{colmeth};
41             }
42             elsif ($key eq 'Encoding') {
43 0           $method = $self->{encmeth};
44             }
45             elsif ($key eq 'XMLVersion') {
46 0           $method = $self->{xmlvmeth};
47             }
48 0 0         if ($method) {
49 0           my $value = $method->($key);
50 0           return $value;
51             }
52 0           return undef;
53             }
54              
55             sub EXISTS {
56 0     0     my ($self, $key) = @_;
57 0 0         if ($key =~ /^(PublicId|SystemId|LineNumber|ColumnNumber|Encoding|XMLVersion)$/) {
58 0           return 1;
59             }
60 0           return 0;
61             }
62              
63             sub STORE {
64 0     0     my ($self, $key, $value) = @_;
65             }
66              
67             sub DELETE {
68 0     0     my ($self, $key) = @_;
69             }
70              
71             sub CLEAR {
72 0     0     my ($self) = @_;
73             }
74              
75             sub FIRSTKEY {
76 0     0     my ($self) = @_;
77             # assignment resets.
78 0           $self->{keys} = {
79             PublicId => 1,
80             SystemId => 1,
81             LineNumber => 1,
82             ColumnNumber => 1,
83             Encoding => 1,
84             XMLVersion => 1,
85             };
86 0           return each %{$self->{keys}};
  0            
87             }
88              
89             sub NEXTKEY {
90 0     0     my ($self, $lastkey) = @_;
91 0           return each %{$self->{keys}};
  0            
92             }
93              
94             1;
95             __END__