lib/Biblio/ILL/ISO/ProviderErrorReport.pm

filter: Statementstmt 53.0% 26 / 49 Branchbran 15.0% 3 / 20 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 77.7% 7 / 9 Podpod 100% 3 / 3 totaltotal 46.5% 40 / 86 CC 13 SCAR 26.3
CC
13
Cov
42%
from_asn
30.0
set
20.0
new
9.4
CRAP 13.9
« lib/Biblio/ILL/ISO/EstimateResults.pm ↑ Summary lib/Biblio/ILL/ISO/AlreadyForwarded.pm »
1 package Biblio::ILL::ISO::ProviderErrorReport;
2  
3 =head1 NAME
4  
5 Biblio::ILL::ISO::ProviderErrorReport
6  
7 =cut
8  
9 4 ▶use Biblio::ILL::ISO::ILLASNtype;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 4 ▶use Biblio::ILL::ISO::GeneralProblem;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 4 ▶use Biblio::ILL::ISO::TransactionIdProblem;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 4 ▶use Biblio::ILL::ISO::StateTransitionProhibited;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 4 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 =head1 VERSION
17  
18 Version 0.01
19  
20 =cut
21  
22 4 our $VERSION = '0.01';
23 #---------------------------------------------------------------------------
24 # Mods
25 # 0.01 - 2003.08.12 - original version
26 #---------------------------------------------------------------------------
27  
28 =head1 DESCRIPTION
29  
30 Biblio::ILL::ISO::ProviderErrorReport is a derivation of Biblio::ILL::ISO::ILLASNtype.
31  
32 =head1 USES
33  
34 Biblio::ILL::ISO::ILLASNtype;
35 Biblio::ILL::ISO::GeneralProblem;
36 Biblio::ILL::ISO::TransactionIdProblem;
37 Biblio::ILL::ISO::StateTransitionProhibited;
38  
39 =head1 USED IN
40  
41 Biblio::ILL::ISO::ErrorReport
42  
43 =cut
44  
45 4 ▶BEGIN{@ISA = qw ( Biblio::ILL::ISO::ILLASNtype );} # inherit from ILLASNtype
Subroutine BEGIN: called CC=1 SCAR=0.0
46  
47 =head1 FROM THE ASN DEFINITION
48
49 Provider-Error-Report ::= CHOICE {
50 general-problem [0] IMPLICIT General-Problem,
51 transaction-id-problem [1] IMPLICIT Transaction-Id-Problem,
52 state-transition-prohibited [2] IMPLICIT State-Transition-Prohibited
53 }
54  
55 =cut
56  
57 =head1 METHODS
58  
59 =cut
60  
61 #---------------------------------------------------------------
62 #
63 #---------------------------------------------------------------
64 =head1
65  
66 =head2 new( [$general_problem | $transaction_id_problem | $state_transition_prohibited] )
67  
68 Creates a new ProviderErrorReport object.
69 Expects one of
70 a general-problem (Biblio::ILL::ISO::GeneralProblem),
71 a transaction-id-problem (Biblio::ILL::ISO::TransactionIdProblem), or
72 a state-transition-prohibited (Biblio::ILL::ISO::StateTransitionProhibited).
73  
74 =cut
75 1 ▶sub new {
Subroutine new: called CC=6 SCAR=22.4
Pod documented
76 1 my $class = shift;
77 1 my $self = {};
78  
79 1 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 1 0 1
80 1 my ($objref) = @_;
81
82 1 ▶ if (ref($objref) eq "Biblio::ILL::ISO::GeneralProblem") {
Branch: 3 branches
BranchTrueFalseTotal
if (ref $objref eq 'Biblio::ILL::ISO::GeneralProblem') { } 0 1 1
elsif (ref $objref eq 'Biblio::ILL::ISO::TransactionIdProblem') { } 1 0 1
elsif (ref $objref eq 'Biblio::ILL::ISO::StateTransitionProhibited') { } 0 0 0
83 0 $self->{"general-problem"} = $objref;
84 } elsif (ref($objref) eq "Biblio::ILL::ISO::TransactionIdProblem") {
85 1 $self->{"transaction-id-problem"} = $objref;
86 } elsif (ref($objref) eq "Biblio::ILL::ISO::StateTransitionProhibited") {
87 0 $self->{"state-transition-prohibited"} = $objref;
88 } else {
89 0 croak "Invalid ProviderErrorReport";
90 }
91 }
92  
93 1 ▶ bless($self, 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
94 1 return ($self);
95 }
96  
97  
98 #---------------------------------------------------------------
99 #
100 #---------------------------------------------------------------
101 =head1
102  
103 =head2 set( [$general_problem | $transaction_id_problem | $state_transition_prohibited] )
104  
105 Sets the object's "problem" type.
106 Expects one of:
107 general-problem (Biblio::ILL::ISO::GeneralProblem),
108 transaction-id-problem (Biblio::ILL::ISO::TransactionIdProblem), or
109 state-transition-prohibited (Biblio::ILL::ISO::StateTransitionProhibited).
110  
111 =cut
112 0 ▶sub set {
Subroutine set: not called CC=4 SCAR=30.0
Pod documented
113 0 my $self = shift;
114 0 my ($objref) = @_;
115
116 0 ▶ if (ref($objref) eq "Biblio::ILL::ISO::GeneralProblem") {
Branch: 3 branches
BranchTrueFalseTotal
if (ref $objref eq 'Biblio::ILL::ISO::GeneralProblem') { } 0 0 0
elsif (ref $objref eq 'Biblio::ILL::ISO::TransactionIdProblem') { } 0 0 0
elsif (ref $objref eq 'Biblio::ILL::ISO::StateTransitionProhibited') { } 0 0 0
117 0 $self->{"general-problem"} = $objref;
118 } elsif (ref($objref) eq "Biblio::ILL::ISO::TransactionIdProblem") {
119 0 $self->{"transaction-id-problem"} = $objref;
120 } elsif (ref($objref) eq "Biblio::ILL::ISO::StateTransitionProhibited") {
121 0 $self->{"state-transition-prohibited"} = $objref;
122 } else {
123 0 croak "Invalid ProviderErrorReport";
124 }
125
126 0 return;
127 }
128  
129 #---------------------------------------------------------------
130 #
131 #---------------------------------------------------------------
132 =head1
133  
134 =head2 from_asn($href)
135  
136 Given a properly formatted hash, builds the object.
137  
138 =cut
139 0 ▶sub from_asn {
Subroutine from_asn: not called CC=5 SCAR=34.0
Pod documented
140 0 my $self = shift;
141 0 my $href = shift;
142  
143 0 foreach my $k (keys %$href) {
144 #print ref($self) . "...$k\n";
145  
146 0 ▶ if ($k =~ /^general-problem$/) {
Branch: 3 branches
BranchTrueFalseTotal
if ($k =~ /^general-problem$/) { } 0 0 0
elsif ($k =~ /^transaction-id-problem$/) { } 0 0 0
elsif ($k =~ /^state-transition-prohibited$/) { } 0 0 0
147 0 $self->{$k} = new Biblio::ILL::ISO::GeneralProblem();
148 0 $self->{$k}->from_asn($href->{$k});
149  
150 } elsif ($k =~ /^transaction-id-problem$/) {
151 0 $self->{$k} = new Biblio::ILL::ISO::TransactionIdProblem();
152 0 $self->{$k}->from_asn($href->{$k});
153  
154 } elsif ($k =~ /^state-transition-prohibited$/) {
155 0 $self->{$k} = new Biblio::ILL::ISO::StateTransitionProhibited();
156 0 $self->{$k}->from_asn($href->{$k});
157  
158 } else {
159 0 croak "invalid " . ref($self) . " element: [$k]";
160 }
161  
162 }
163 0 return $self;
164 }
165  
166 =head1 SEE ALSO
167  
168 See the README for system design notes.
169 See the parent class(es) for other available methods.
170  
171 For more information on Interlibrary Loan standards (ISO 10160/10161),
172 a good place to start is:
173  
174 http://www.nlc-bnc.ca/iso/ill/main.htm
175  
176 =cut
177  
178 =head1 AUTHOR
179  
180 David Christensen, <DChristensenSPAMLESS@westman.wave.ca>
181  
182 =cut
183  
184  
185 =head1 COPYRIGHT AND LICENSE
186  
187 Copyright 2003 by David Christensen
188  
189 This library is free software; you can redistribute it and/or modify it
190 under the same terms as Perl itself.
191  
192 =cut
193  
194 4 1;
« lib/Biblio/ILL/ISO/EstimateResults.pm ↑ Summary lib/Biblio/ILL/ISO/AlreadyForwarded.pm »