lib/Biblio/ILL/ISO/RetryResults.pm

filter: Statementstmt 57.8% 33 / 57 Branchbran 22.5% 9 / 40 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 77.7% 7 / 9 Podpod 100% 3 / 3 totaltotal 46.4% 53 / 114 CC 23 SCAR 35.9
CC
23
Cov
43%
set
90.0
from_asn
30.0
new
14.5
CRAP 36.3
« lib/Biblio/ILL/ISO/HoldPlacedResults.pm ↑ Summary lib/Biblio/ILL/ISO/ForwardNotification.pm »
1 package Biblio::ILL::ISO::RetryResults;
2  
3 =head1 NAME
4  
5 Biblio::ILL::ISO::RetryResults
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::ReasonNotAvailable;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 4 ▶use Biblio::ILL::ISO::ISODate;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 4 ▶use Biblio::ILL::ISO::LocationInfoSequence;
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.07.26 - original version
26 #---------------------------------------------------------------------------
27  
28 =head1 DESCRIPTION
29  
30 Biblio::ILL::ISO::RetryResults is a derivation of Biblio::ILL::ISO::ILLASNtype.
31  
32 =head1 USES
33  
34 Biblio::ILL::ISO::ReasonNotAvailable;
35 Biblio::ILL::ISO::ISODate;
36 Biblio::ILL::ISO::LocationInfoSequence;
37  
38 =head1 USED IN
39  
40 Biblio::ILL::ISO::ResultsExplanation
41  
42 =cut
43  
44 4 ▶BEGIN{@ISA = qw ( Biblio::ILL::ISO::ILLASNtype );} # inherit from ILLASNtype
Subroutine BEGIN: called CC=1 SCAR=0.0
45  
46 =head1 FROM THE ASN DEFINITION
47
48 Retry-Results ::= EXPLICIT SEQUENCE {
49 reason-not-available [0] IMPLICIT Reason-Not-Available OPTIONAL,
50 retry-date [1] IMPLICIT ISO-Date OPTIONAL,
51 locations [2] IMPLICIT SEQUENCE OF Location-Info OPTIONAL
52 }
53  
54 =cut
55  
56 =head1 METHODS
57  
58 =cut
59  
60 #---------------------------------------------------------------
61 #
62 #---------------------------------------------------------------
63 =head1
64  
65 =head2 new( $reason [,$replydate] [,$locations] )
66  
67 Creates a new RetryResults object.
68 Expects a reason-not-available (Biblio::ILL::ISO::ReasonNotAvailable),
69 (optionally) a date for reply (Biblio::ILL::ISO::ISODate), and
70 (optionally) a location sequence (Biblio::ILL::ISO::LocationInfoSequence).
71  
72 =cut
73 1 ▶sub new {
Subroutine new: called CC=11 SCAR=26.7
Pod documented
74 1 my $class = shift;
75 1 my $self = {};
76  
77 1 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 1 0 1
78 1 my ($reason, $replydate, $locations) = @_;
79  
80 1 ▶ croak "missing retry-result reason-not-available" unless ($reason);
Branch: 1 branch
BranchTrueFalseTotal
unless $reason 0 1 1
81 1 ▶ croak "invalid retry-result reason-not-available" unless (ref($reason) eq "Biblio::ILL::ISO::ReasonNotAvailable");
Branch: 1 branch
BranchTrueFalseTotal
unless ref $reason eq "Biblio::ILL::ISO::ReasonNotAvailable" 0 1 1
82  
83 1 ▶ if ($replydate) {
Branch: 1 branch
BranchTrueFalseTotal
if ($replydate) 1 0 1
84 1 ▶ croak "invalid retry-date" unless (ref($replydate) eq "Biblio::ILL::ISO::ISODate");
Branch: 1 branch
BranchTrueFalseTotal
unless ref $replydate eq "Biblio::ILL::ISO::ISODate" 0 1 1
85 }
86 1 ▶ if ($locations) {
Branch: 1 branch
BranchTrueFalseTotal
if ($locations) 1 0 1
87 1 ▶ croak "invalid locations" unless (ref($locations) eq "Biblio::ILL::ISO::LocationInfoSequence");
Branch: 1 branch
BranchTrueFalseTotal
unless ref $locations eq "Biblio::ILL::ISO::LocationInfoSequence" 0 1 1
88 }
89
90 1 $self->{"reason-not-available"} = $reason;
91 1 ▶ $self->{"retry-date"} = $replydate if ($replydate);
Branch: 1 branch
BranchTrueFalseTotal
if $replydate 1 0 1
92 1 ▶ $self->{"locations"} = $locations if ($locations);;
Branch: 1 branch
BranchTrueFalseTotal
if $locations 1 0 1
93 }
94  
95 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
96 1 return ($self);
97 }
98  
99  
100 #---------------------------------------------------------------
101 #
102 #---------------------------------------------------------------
103 =head1
104  
105 =head2 set( $reason [,$replydate] [,$locations] [,proposed_delivery_service] )
106  
107 Sets the object's reason-not-available (Biblio::ILL::ISO::ReasonNotAvailable),
108 (optionally) date-for-reply (Biblio::ILL::ISO::ISODate), and
109 (optionally) locations (Biblio::ILL::ISO::LocationInfoSequence).
110  
111 =cut
112 0 ▶sub set {
Subroutine set: not called CC=9 SCAR=45.0
Pod documented
113 0 my $self = shift;
114  
115 0 my ($reason, $replydate, $locations) = @_;
116
117 0 ▶ croak "missing retry-result reason-not-available" unless ($reason);
Branch: 1 branch
BranchTrueFalseTotal
unless $reason 0 0 0
118 0 ▶ croak "invalid retry-result reason-not-available" unless (ref($reason) eq "Biblio::ILL::ISO::ReasonNotAvailable");
Branch: 1 branch
BranchTrueFalseTotal
unless ref $reason eq "Biblio::ILL::ISO::ReasonNotAvailable" 0 0 0
119
120 0 ▶ if ($replydate) {
Branch: 1 branch
BranchTrueFalseTotal
if ($replydate) 0 0 0
121 0 ▶ croak "invalid retry-date" unless (ref($replydate) eq "Biblio::ILL::ISO::ISODate");
Branch: 1 branch
BranchTrueFalseTotal
unless ref $replydate eq "Biblio::ILL::ISO::ISODate" 0 0 0
122 }
123 0 ▶ if ($locations) {
Branch: 1 branch
BranchTrueFalseTotal
if ($locations) 0 0 0
124 0 ▶ croak "invalid locations" unless (ref($locations) eq "Biblio::ILL::ISO::LocationInfoSequence");
Branch: 1 branch
BranchTrueFalseTotal
unless ref $locations eq "Biblio::ILL::ISO::LocationInfoSequence" 0 0 0
125 }
126
127 0 $self->{"reason-not-available"} = $reason;
128 0 ▶ $self->{"retry-date"} = $replydate if ($replydate);
Branch: 1 branch
BranchTrueFalseTotal
if $replydate 0 0 0
129 0 ▶ $self->{"locations"} = $locations if ($locations);;
Branch: 1 branch
BranchTrueFalseTotal
if $locations 0 0 0
130
131 0 return;
132 }
133  
134 #---------------------------------------------------------------
135 #
136 #---------------------------------------------------------------
137 =head1
138  
139 =head2 from_asn($href)
140  
141 Given a properly formatted hash, builds the object.
142  
143 =cut
144 0 ▶sub from_asn {
Subroutine from_asn: not called CC=5 SCAR=34.0
Pod documented
145 0 my $self = shift;
146 0 my $href = shift;
147  
148 0 foreach my $k (keys %$href) {
149 #print ref($self) . "...$k\n";
150  
151 0 ▶ if ($k =~ /^reason-not-available$/) {
Branch: 3 branches
BranchTrueFalseTotal
if ($k =~ /^reason-not-available$/) { } 0 0 0
elsif ($k =~ /^retry-date$/) { } 0 0 0
elsif ($k =~ /^locations$/) { } 0 0 0
152 0 $self->{$k} = new Biblio::ILL::ISO::ReasonNotAvailable();
153 0 $self->{$k}->from_asn($href->{$k});
154
155 } elsif ($k =~ /^retry-date$/) {
156 0 $self->{$k} = new Biblio::ILL::ISO::ISODate();
157 0 $self->{$k}->from_asn($href->{$k});
158  
159 } elsif ($k =~ /^locations$/) {
160 0 $self->{$k} = new Biblio::ILL::ISO::LocationInfoSequence();
161 0 $self->{$k}->from_asn($href->{$k});
162  
163 } else {
164 0 croak "invalid " . ref($self) . " element: [$k]";
165 }
166  
167 }
168 0 return $self;
169 }
170  
171 =head1 SEE ALSO
172  
173 See the README for system design notes.
174 See the parent class(es) for other available methods.
175  
176 For more information on Interlibrary Loan standards (ISO 10160/10161),
177 a good place to start is:
178  
179 http://www.nlc-bnc.ca/iso/ill/main.htm
180  
181 =cut
182  
183 =head1 AUTHOR
184  
185 David Christensen, <DChristensenSPAMLESS@westman.wave.ca>
186  
187 =cut
188  
189  
190 =head1 COPYRIGHT AND LICENSE
191  
192 Copyright 2003 by David Christensen
193  
194 This library is free software; you can redistribute it and/or modify it
195 under the same terms as Perl itself.
196  
197 =cut
198 =head1
199  
200 =head2 from_asn($href)
201  
202 Given a properly formatted hash, builds the object.
203  
204 =cut
205  
206 4 1;
« lib/Biblio/ILL/ISO/HoldPlacedResults.pm ↑ Summary lib/Biblio/ILL/ISO/ForwardNotification.pm »