blib/lib/HTTP/OAI/SAX/Text.pm

filter: Statementstmt 100% 21 / 21 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod 100% 3 / 3 totaltotal 96.6% 29 / 30 CC 2 SCAR 3.4
CC
2
Cov
96%
end_element
2.0
BEGIN
1.0
start_element
1.0
CRAP 1.4
« blib/lib/HTTP/OAI/SAX/Base.pm ↑ Summary blib/lib/HTTP/OAI/SAX/Trace.pm »
1 package HTTP::OAI::SAX::Text;
2  
3 11 @ISA = qw( XML::SAX::Base );
4  
5 11 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 11 our $VERSION = '4.07';
8  
9 sub start_element
10 {
11 493 ▶ ( my $self, my $hash, @_ ) = @_;
Subroutine start_element: called CC=1 SCAR=0.0
Pod documented
12  
13 493 $self->{Data} = "";
14 493 push @{$self->{Attributes}}, $hash->{Attributes};
15  
16 493 $self->SUPER::start_element( $hash, @_ );
17 }
18  
19 772 ▶sub characters { $_[0]->{Data} .= $_[1]->{Data} }
Subroutine characters: called CC=1 SCAR=0.0
Pod documented
20  
21 sub end_element
22 {
23 484 ▶ ( my $self, my $hash, @_ ) = @_;
Subroutine end_element: called CC=2 SCAR=6.9
Pod documented
24  
25 484 $hash->{Text} = $self->{Data};
26 484 ▶ $hash->{Attributes} = pop @{$self->{Attributes} || []};
Branch: 1 branch
BranchTrueFalseTotal
$self->{"Attributes"} or [] 0 484 484
27  
28 # strip surrounding whitespace in leaf nodes
29 484 $hash->{Text} =~ s/^\s+//;
30 484 $hash->{Text} =~ s/\s+$//;
31  
32 484 $self->SUPER::characters( {Data => $self->{Data}}, @_ );
33  
34 484 $self->{Data} = "";
35  
36 484 $self->SUPER::end_element( $hash, @_ );
37 }
38  
39 11 1;
40  
41 =head1 NAME
42  
43 HTTP::OAI::SAX::Text
44  
45 =head1 DESCRIPTION
46  
47 This module adds Text and Attributes to the end_element call. This is only useful for leaf nodes (elements that don't contain any child elements).
« blib/lib/HTTP/OAI/SAX/Base.pm ↑ Summary blib/lib/HTTP/OAI/SAX/Trace.pm »