blib/lib/Net/OAI/ListSets.pm

filter: Statementstmt 35.0% 14 / 40 Branchbran 0.0% 0 / 10 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 44.4% 4 / 9 Podpod 100% 6 / 6 totaltotal 35.7% 25 / 70 SCAR 32.2
CC
7
Cov
28%
end_element
12.0
setName
6.0
start_element
6.0
CRAP 25.1
« blib/lib/Net/OAI/ListIdentifiers.pm ↑ Summary blib/lib/Net/OAI/Record.pm »
1 package Net::OAI::ListSets;
2  
3 17 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 17 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 17 ▶use base qw( XML::SAX::Base Net::OAI::Base );
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 =head1 NAME
8  
9 Net::OAI::ListSets - The results of the ListSets OAI-PMH verb.
10  
11 =head1 SYNOPSIS
12  
13 =head1 DESCRIPTION
14  
15 =head1 METHODS
16  
17 =head2 new()
18  
19 =cut
20  
21 sub new {
22 1 ▶ my ( $class, %opts ) = @_;
Subroutine new: called CC=2 SCAR=7.4
Pod documented
23 1 ▶ my $self = bless \%opts, ref( $class ) || $class;
Condition33%1/3
ref $class || $class
l!l&&r!l&&!r
010
MC/DC0%0/2
ref $class || $class
ref $class $class
Truth table33%1/3
A || B
A= ref $classB= $class
ABresult
1X1
011
000
24 1 $self->{ specs } = {};
25 1 return( $self );
26 }
27  
28 =head2 setSpecs()
29  
30 Get back a list of set specification codes.
31  
32 =cut
33  
34 sub setSpecs {
35 0 ▶ my $self = shift;
Subroutine setSpecs: not called CC=1 SCAR=6.9
Pod documented
36 0 return( sort( keys( %{ $self->{ specs } } ) ) );
37 }
38  
39 =head2 setName()
40  
41 Pass in a setSpec code, and get back it's name...or undef if the set spec does
42 not exist for this repository.
43  
44 =cut
45  
46 sub setName {
47 0 ▶ my ( $self, $setSpec ) = @_;
Subroutine setName: not called CC=2 SCAR=17.9
Pod documented
48 0 ▶ if ( exists( $self->{ specs }{ $setSpec } ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{"specs"}{$setSpec}) 0 0 0
49 0 return( $self->{ specs }{ $setSpec } );
50 }
51 0 return( undef );
52 }
53  
54 ## SAX Handlers
55  
56 sub start_element {
57 0 ▶ my ( $self, $element ) = @_;
Subroutine start_element: not called CC=2 SCAR=17.9
Pod documented
58 0 $self->SUPER::start_element( $element );
59 0 ▶ return unless $element->{ NamespaceURI } eq Net::OAI::Harvester::XMLNS_OAI;
Branch: 1 branch
BranchTrueFalseTotal
unless $element->{"NamespaceURI"} eq "http://www.openarchives.org/OAI/2.0/" 0 0 0
60 0 push( @{ $self->{ tagStack } }, $element->{ LocalName } );
61 }
62  
63 sub end_element {
64 0 ▶ my ( $self, $element ) = @_;
Subroutine end_element: not called CC=3 SCAR=24.8
Pod documented
65 0 $self->SUPER::end_element( $element );
66 0 ▶ return unless $element->{ NamespaceURI } eq Net::OAI::Harvester::XMLNS_OAI;
Branch: 1 branch
BranchTrueFalseTotal
unless $element->{"NamespaceURI"} eq "http://www.openarchives.org/OAI/2.0/" 0 0 0
67 0 pop( @{ $self->{ tagStack } } );
68 0 ▶ if ( $element->{ LocalName } eq 'set' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($element->{"LocalName"} eq "set") 0 0 0
69 0 $self->{ specs }{ $self->{ setSpec } } = $self->{ setName };
70 0 $self->{ setSpec } = $self->{ setName } = undef;
71 }
72 }
73  
74 sub characters {
75 0 ▶ my ( $self, $characters ) = @_;
Subroutine characters: not called CC=2 SCAR=17.9
Pod documented
76 0 my $insideTag = @{ $self->{ tagStack } }[-1];
77 0 ▶ if ( $insideTag =~ /^(setName|setSpec)$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($insideTag =~ /^(setName|setSpec)$/) 0 0 0
78 0 $self->{ $insideTag } .= $characters->{ Data };
79 }
80 0 $self->SUPER::characters( $characters );
81 }
82  
83 17 1;
« blib/lib/Net/OAI/ListIdentifiers.pm ↑ Summary blib/lib/Net/OAI/Record.pm »