line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# An example of simple SAX Handler |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package MyHandler; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
sub new { |
6
|
0
|
|
|
0
|
0
|
|
my $type = shift; |
7
|
0
|
|
|
|
|
|
return bless {}, $type; |
8
|
|
|
|
|
|
|
} |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub start_document { |
11
|
0
|
|
|
0
|
0
|
|
my ($self, $document) = @_; |
12
|
|
|
|
|
|
|
|
13
|
0
|
|
|
|
|
|
print "Starting document\n"; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub end_document { |
17
|
0
|
|
|
0
|
0
|
|
my ($self, $document) = @_; |
18
|
|
|
|
|
|
|
|
19
|
0
|
|
|
|
|
|
print "Ending document\n"; |
20
|
0
|
|
|
|
|
|
return 1; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub start_element { |
24
|
0
|
|
|
0
|
0
|
|
my ($self, $element) = @_; |
25
|
|
|
|
|
|
|
|
26
|
0
|
|
|
|
|
|
print "<$element->{Name} "; |
27
|
0
|
|
|
|
|
|
foreach (keys %{$element->{Attributes}}) { |
|
0
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
|
print "$element->{Attributes}->{$_}->{Name}="; |
29
|
0
|
|
|
|
|
|
print "\"$element->{Attributes}->{$_}->{Value}\" "; |
30
|
|
|
|
|
|
|
} |
31
|
0
|
|
|
|
|
|
print ">\n"; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub end_element { |
35
|
0
|
|
|
0
|
0
|
|
my ($self, $element) = @_; |
36
|
|
|
|
|
|
|
|
37
|
0
|
|
|
|
|
|
print "$element->{Name}>\n"; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub characters { |
41
|
0
|
|
|
0
|
0
|
|
my ($self, $characters) = @_; |
42
|
|
|
|
|
|
|
|
43
|
0
|
|
|
|
|
|
print "$characters->{Data}\n"; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
1; |