blib/lib/HTTP/OAI/Metadata.pm

filter: Statementstmt 96.0% 24 / 25 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 87.5% 7 / 8 Podpod 57.1% 4 / 7 totaltotal 85.7% 36 / 42 CC 3 SCAR 5.3
CC
3
Cov
93%
start_element
3.0
metadata
2.0
BEGIN
1.0
CRAP 1.7
« blib/lib/HTTP/OAI/GetRecord.pm ↑ Summary blib/lib/HTTP/OAI/SAX/Base.pm »
1 package HTTP::OAI::Metadata;
2  
3 11 @ISA = qw( HTTP::OAI::MemberMixin HTTP::OAI::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 new
10 {
11 15 ▶ my( $class, %self ) = @_;
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
12  
13 15 $self{doc} = XML::LibXML::Document->new( '1.0', 'UTF-8' );
14 15 $self{dom} = $self{current} = $self{doc}->createDocumentFragment;
15  
16 15 return bless \%self, $class;
17 }
18  
19 0 ▶sub metadata { shift->dom( @_ ) }
Subroutine metadata: not called CC=1 SCAR=6.9
Pod undocumented
20 4 ▶sub dom { shift->_elem( "dom", @_ ) }
Subroutine dom: called CC=1 SCAR=0.0
Pod documented
21  
22 sub generate
23 {
24 3 ▶ my( $self, $driver ) = @_;
Subroutine generate: called CC=1 SCAR=0.0
Pod undocumented
25  
26 3 $driver->generate( $self->dom );
27 }
28  
29 sub start_element
30 {
31 175 ▶ my( $self, $hash ) = @_;
Subroutine start_element: called CC=3 SCAR=11.0
Pod documented
32  
33 my $node = $self->{doc}->createElementNS(
34 $hash->{NamespaceURI},
35 $hash->{Name},
36 175 );
37 175 foreach my $attr (values %{$hash->{Attributes}})
38 {
39 119 ▶ Carp::confess "Can't setAttribute without attribute name" if !defined $attr->{Name};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $attr->{"Name"} 0 119 119
40 119 $node->setAttribute( $attr->{Name}, $attr->{Value} );
41 }
42  
43 175 $self->{current} = $self->{current}->appendChild( $node );
44 }
45  
46 sub end_element
47 {
48 175 ▶ my( $self, $hash ) = @_;
Subroutine end_element: called CC=1 SCAR=0.0
Pod documented
49  
50 175 $self->{current} = $self->{current}->parentNode;
51 }
52  
53 sub characters
54 {
55 175 ▶ my( $self, $hash ) = @_;
Subroutine characters: called CC=1 SCAR=0.0
Pod documented
56  
57 175 $self->{current}->appendText( $hash->{Data} );
58 }
59  
60 11 1;
61  
62 __END__
« blib/lib/HTTP/OAI/GetRecord.pm ↑ Summary blib/lib/HTTP/OAI/SAX/Base.pm »