lib/Biblio/ILL/ISO/ConditionalResults.pm

filter: Statementstmt 57.3% 39 / 68 Branchbran 22.2% 12 / 54 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 80.0% 8 / 10 Podpod 100% 3 / 3 totaltotal 45.0% 63 / 140 CC 30 SCAR 41.2
CC
30
Cov
42%
set
156.0
from_asn
42.0
new
19.9
CRAP 61.8
« lib/Biblio/ILL/ISO/PostalAddress.pm ↑ Summary lib/Biblio/ILL/ISO/ResultsExplanation.pm »
1 package Biblio::ILL::ISO::ConditionalResults;
2  
3 =head1 NAME
4  
5 Biblio::ILL::ISO::ConditionalResults
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::ConditionalResultsCondition;
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 4 ▶use Biblio::ILL::ISO::DeliveryService;
Subroutine BEGIN: called CC=1 SCAR=0.0
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::ConditionalResults is a derivation of Biblio::ILL::ISO::ILLASNtype.
31  
32 =head1 USES
33  
34 Biblio::ILL::ISO::ConditionalResultsCondition
35 Biblio::ILL::ISO::ISODate
36 Biblio::ILL::ISO::LocationInfoSequence
37 Biblio::ILL::ISO::DeliveryService
38  
39 =head1 USED IN
40  
41 Biblio::ILL::ISO::ResultsExplanation
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 Conditional-Results ::= EXPLICIT SEQUENCE {
50 conditions [0] IMPLICIT ENUMERATED {
51 cost-exceeds-limit (13),
52 charges (14),
53 prepayment-required (15),
54 lacks-copyright-compliance (16),
55 library-use-only (22),
56 no-reproduction (23),
57 client-signature-required (24),
58 special-collections-supervision-required (25),
59 other (27),
60 responder-specific (28),
61 proposed-delivery-service (30)
62 },
63 date-for-reply [1] IMPLICIT ISO-Date OPTIONAL,
64 locations [2] IMPLICIT SEQUENCE OF Location-Info OPTIONAL,
65 proposed-delivery-service Delivery-Service OPTIONAL
66 -- this parameter specifies a proposed delivery service the
67 -- acceptance of which is a condition of supply. It may be a
68 -- physical service or an electronic service. This parameter
69 -- may only be present in APDUs with a
70 -- protocol-version-num value of 2 or greater
71 }
72  
73 =cut
74  
75 =head1 METHODS
76  
77 =cut
78  
79 #---------------------------------------------------------------
80 #
81 #---------------------------------------------------------------
82 =head1
83  
84 =head2 new( $condition [,$replydate] [,$locations] [,proposed_delivery_service] )
85  
86 Creates a new ConditionalResults object.
87 Expects a condition (Biblio::ILL::ISO::ConditionalResultsCondition),
88 (optionally) a date for reply (Biblio::ILL::ISO::ISODate),
89 (optionally) a location sequence (Biblio::ILL::ISO::LocationInfoSequence), and
90 (optionally) a proposed delivery service (Biblio::ILL::ISO::DeliveryService).
91  
92 =cut
93 2 ▶sub new {
Subroutine new: called CC=14 SCAR=29.9
Pod documented
94 2 my $class = shift;
95 2 my $self = {};
96  
97 2 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 2 0 2
98 2 my ($condition, $replydate, $locations, $proposed_delivery_service) = @_;
99  
100 2 ▶ croak "missing conditional-result condition" unless ($condition);
Branch: 1 branch
BranchTrueFalseTotal
unless $condition 0 2 2
101 2 ▶ croak "invalid conditional-result condition" unless (ref($condition) eq "Biblio::ILL::ISO::ConditionalResultsCondition");
Branch: 1 branch
BranchTrueFalseTotal
unless ref $condition eq "Biblio::ILL::ISO::ConditionalResultsCondition" 0 2 2
102  
103 2 ▶ if ($replydate) {
Branch: 1 branch
BranchTrueFalseTotal
if ($replydate) 2 0 2
104 2 ▶ croak "invalid date-for-reply" unless (ref($replydate) eq "Biblio::ILL::ISO::ISODate");
Branch: 1 branch
BranchTrueFalseTotal
unless ref $replydate eq "Biblio::ILL::ISO::ISODate" 0 2 2
105 }
106 2 ▶ if ($locations) {
Branch: 1 branch
BranchTrueFalseTotal
if ($locations) 2 0 2
107 2 ▶ croak "invalid locations" unless (ref($locations) eq "Biblio::ILL::ISO::LocationInfoSequence");
Branch: 1 branch
BranchTrueFalseTotal
unless ref $locations eq "Biblio::ILL::ISO::LocationInfoSequence" 0 2 2
108 }
109 2 ▶ if ($proposed_delivery_service) {
Branch: 1 branch
BranchTrueFalseTotal
if ($proposed_delivery_service) 2 0 2
110 2 ▶ croak "invalid proposed-delivery-service" unless (ref($proposed_delivery_service) eq "Biblio::ILL::ISO::DeliveryService");
Branch: 1 branch
BranchTrueFalseTotal
unless ref $proposed_delivery_service eq "Biblio::ILL::ISO::DeliveryService" 0 2 2
111 }
112
113 2 $self->{"conditions"} = $condition;
114 2 ▶ $self->{"date-for-reply"} = $replydate if ($replydate);
Branch: 1 branch
BranchTrueFalseTotal
if $replydate 2 0 2
115 2 ▶ $self->{"locations"} = $locations if ($locations);;
Branch: 1 branch
BranchTrueFalseTotal
if $locations 2 0 2
116 2 ▶ $self->{"proposed-delivery-service"} = $proposed_delivery_service if ($proposed_delivery_service);
Branch: 1 branch
BranchTrueFalseTotal
if $proposed_delivery_service 2 0 2
117 }
118  
119 2 ▶ bless($self, ref($class) || $class);
Condition33%1/3
ref $class || $class
l!l&&r!l&&!r
020
MC/DC0%0/2
ref $class || $class
ref $class $class
Truth table33%1/3
A || B
A= ref $classB= $class
ABresult
1X1
011
000
120 2 return ($self);
121 }
122  
123  
124 #---------------------------------------------------------------
125 #
126 #---------------------------------------------------------------
127 =head1
128  
129 =head2 set( $condition [,$replydate] [,$locations] [,proposed_delivery_service] )
130  
131 Sets the object's conditional-result (Biblio::ILL::ISO::ConditionalResultsCondition),
132 (optionally) date-for-reply (Biblio::ILL::ISO::ISODate),
133 (optionally) locations (Biblio::ILL::ISO::LocationInfoSequence), and
134 (optionally) a proposed-delivery-service (Biblio::ILL::ISO::DeliveryService).
135  
136 =cut
137 0 ▶sub set {
Subroutine set: not called CC=12 SCAR=50.5
Pod documented
138 0 my $self = shift;
139  
140 0 my ($condition, $replydate, $locations, $proposed_delivery_service) = @_;
141  
142 0 ▶ croak "missing conditional-result condition" unless ($condition);
Branch: 1 branch
BranchTrueFalseTotal
unless $condition 0 0 0
143 0 ▶ croak "invalid conditional-result condition" unless (ref($condition) eq "Biblio::ILL::ISO::ConditionalResultsCondition");
Branch: 1 branch
BranchTrueFalseTotal
unless ref $condition eq "Biblio::ILL::ISO::ConditionalResultsCondition" 0 0 0
144
145 0 ▶ if ($replydate) {
Branch: 1 branch
BranchTrueFalseTotal
if ($replydate) 0 0 0
146 0 ▶ croak "invalid date-for-reply" unless (ref($replydate) eq "Biblio::ILL::ISO::ISODate");
Branch: 1 branch
BranchTrueFalseTotal
unless ref $replydate eq "Biblio::ILL::ISO::ISODate" 0 0 0
147 }
148 0 ▶ if ($locations) {
Branch: 1 branch
BranchTrueFalseTotal
if ($locations) 0 0 0
149 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
150 }
151 0 ▶ if ($proposed_delivery_service) {
Branch: 1 branch
BranchTrueFalseTotal
if ($proposed_delivery_service) 0 0 0
152 0 ▶ croak "invalid proposed-delivery-service" unless (ref($proposed_delivery_service) eq "Biblio::ILL::ISO::DeliveryService");
Branch: 1 branch
BranchTrueFalseTotal
unless ref $proposed_delivery_service eq "Biblio::ILL::ISO::DeliveryService" 0 0 0
153 }
154
155 0 $self->{"conditions"} = $condition;
156 0 ▶ $self->{"date-for-reply"} = $replydate if ($replydate);
Branch: 1 branch
BranchTrueFalseTotal
if $replydate 0 0 0
157 0 ▶ $self->{"locations"} = $locations if ($locations);;
Branch: 1 branch
BranchTrueFalseTotal
if $locations 0 0 0
158 0 ▶ $self->{"proposed-delivery-service"} = $proposed_delivery_service if ($proposed_delivery_service);
Branch: 1 branch
BranchTrueFalseTotal
if $proposed_delivery_service 0 0 0
159
160 0 return;
161 }
162  
163 #---------------------------------------------------------------
164 #
165 #---------------------------------------------------------------
166 =head1
167  
168 =head2 from_asn($href)
169  
170 Given a properly formatted hash, builds the object.
171  
172 =cut
173 0 ▶sub from_asn {
Subroutine from_asn: not called CC=6 SCAR=37.4
Pod documented
174 0 my $self = shift;
175 0 my $href = shift;
176  
177 0 foreach my $k (keys %$href) {
178 #print ref($self) . "...$k\n";
179  
180 0 ▶ if ($k =~ /^conditions$/) {
Branch: 4 branches
BranchTrueFalseTotal
if ($k =~ /^conditions$/) { } 0 0 0
elsif ($k =~ /^date-for-reply$/) { } 0 0 0
elsif ($k =~ /^locations$/) { } 0 0 0
elsif ($k =~ /^proposed-delivery-service$/) { } 0 0 0
181 0 $self->{$k} = new Biblio::ILL::ISO::ConditionalResultsCondition();
182 0 $self->{$k}->from_asn($href->{$k});
183
184 } elsif ($k =~ /^date-for-reply$/) {
185 0 $self->{$k} = new Biblio::ILL::ISO::ISODate();
186 0 $self->{$k}->from_asn($href->{$k});
187  
188 } elsif ($k =~ /^locations$/) {
189 0 $self->{$k} = new Biblio::ILL::ISO::LocationInfoSequence();
190 0 $self->{$k}->from_asn($href->{$k});
191  
192 } elsif ($k =~ /^proposed-delivery-service$/) {
193 0 $self->{$k} = new Biblio::ILL::ISO::DeliveryService();
194 0 $self->{$k}->from_asn($href->{$k});
195  
196 } else {
197 0 croak "invalid " . ref($self) . " element: [$k]";
198 }
199  
200 }
201 0 return $self;
202 }
203  
204 =head1 SEE ALSO
205  
206 See the README for system design notes.
207 See the parent class(es) for other available methods.
208  
209 For more information on Interlibrary Loan standards (ISO 10160/10161),
210 a good place to start is:
211  
212 http://www.nlc-bnc.ca/iso/ill/main.htm
213  
214 =cut
215  
216 =head1 AUTHOR
217  
218 David Christensen, <DChristensenSPAMLESS@westman.wave.ca>
219  
220 =cut
221  
222  
223 =head1 COPYRIGHT AND LICENSE
224  
225 Copyright 2003 by David Christensen
226  
227 This library is free software; you can redistribute it and/or modify it
228 under the same terms as Perl itself.
229  
230 =cut
231  
232 4 1;
« lib/Biblio/ILL/ISO/PostalAddress.pm ↑ Summary lib/Biblio/ILL/ISO/ResultsExplanation.pm »