blib/lib/HTTP/OAI/Error.pm

filter: Statementstmt 100% 24 / 24 Branchbran 100% 2 / 2 Conditioncond 50.0% 4 / 8 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 100% 8 / 8 Podpod 83.3% 5 / 6 totaltotal 82.6% 43 / 52 CC 5 SCAR 7.8
CC
5
Cov
88%
generate
3.7
new
3.0
BEGIN
1.0
CRAP 2.2
« blib/lib/HTTP/OAI/Metadata/METS.pm ↑ Summary blib/lib/HTTP/OAI/Verb.pm »
1 package HTTP::OAI::Error;
2  
3 11 @ISA = qw( HTTP::OAI::SAX::Base HTTP::OAI::MemberMixin Exporter );
4  
5 11 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 11 ▶use vars qw(@EXPORT @EXPORT_OK %EXPORT_TAG);
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 11 our $VERSION = '4.07';
10  
11 11 @EXPORT = qw();
12 11 @EXPORT_OK = qw(%OAI_ERRORS);
13 11 %EXPORT_TAG = ();
14  
15 11 my %OAI_ERRORS = (
16 badArgument => 'The request includes illegal arguments, is missing required arguments, includes a repeated argument, or values for arguments have an illegal syntax.',
17 # badGranularity => 'The values of the from and until arguments are illegal or specify a finer granularity than is supported by the repository.',
18 badResumptionToken => 'The value of the resumptionToken argument is invalid or expired.',
19 badVerb => 'Value of the verb argument is not a legal OAI-PMH verb, the verb argument is missing, or the verb argument is repeated.',
20 cannotDisseminateFormat => 'The metadata format identified by the value given for the metadataPrefix argument is not supported by the item or by the repository',
21 idDoesNotExist => 'The value of the identifier argument is unknown or illegal in this repository.',
22 noRecordsMatch => 'The combination of the values of the from, until, set, and metadataPrefix arguments results in an empty list.',
23 noMetadataFormats => 'There are no metadata formats available for the specified item.',
24 noSetHierarchy => 'The repository does not support sets.'
25 );
26  
27 sub new
28 {
29 6 ▶ my( $class, %self ) = @_;
Subroutine new: called CC=3 SCAR=11.0
Pod documented
30  
31 6 ▶ $self{message} ||= $OAI_ERRORS{$self{code}} if $self{code};
Branch: 1 branch
BranchTrueFalseTotal
if $self{"code"} 4 2 6
Condition66%2/3
$self{"message"} ||= $OAI_ERRORS{$self{"code"}}
l!l&&r!l&&!r
130
MC/DC0%0/2
$self{"message"} ||= $OAI_ERRORS{$self{"code"}}
$self{"message"} $OAI_ERRORS{$self{"code"}}
Truth table66%2/3
A ||= B
A= $self{"message"}B= $OAI_ERRORS{$self{"code"}}
ABresult
1X1
011
000
32  
33 6 return $class->SUPER::new(%self);
34 }
35  
36 12 ▶sub code { shift->_elem('code',@_) }
Subroutine code: called CC=1 SCAR=0.0
Pod documented
37 7 ▶sub message { shift->_elem('message',@_) }
Subroutine message: called CC=1 SCAR=0.0
Pod documented
38  
39 sub generate
40 {
41 1 ▶ my( $self, $driver ) = @_;
Subroutine generate: called CC=3 SCAR=13.1
Pod undocumented
42  
43 1 ▶ $driver->data_element( 'error', ($self->message || $OAI_ERRORS{$self->code} || ''),
Condition40%2/5
$self->message || $OAI_ERRORS{$self->code} || ''
l!l
10
$self->message or $OAI_ERRORS{$self->code}
l!l&&r!l&&!r
100
MC/DC0%0/2
$self->message || $OAI_ERRORS{$self->code} || ''
$self->message $OAI_ERRORS{$self->code}
Truth table33%1/3
A or B
A= $self->messageB= $OAI_ERRORS{$self->code}
ABresult
1X1
011
000
44 code => $self->code,
45 );
46 }
47  
48 sub start_element
49 {
50 2 ▶ my( $self, $hash ) = @_;
Subroutine start_element: called CC=1 SCAR=0.0
Pod documented
51  
52 2 $self->code( $hash->{Attributes}->{'{}code'}->{Value} );
53 }
54  
55 sub characters
56 {
57 2 ▶ my( $self, $hash ) = @_;
Subroutine characters: called CC=1 SCAR=0.0
Pod documented
58  
59 2 $self->message( $hash->{Data} );
60 }
61  
62 11 1;
63  
64 __END__
« blib/lib/HTTP/OAI/Metadata/METS.pm ↑ Summary blib/lib/HTTP/OAI/Verb.pm »