lib/Biblio/ILL/ISO/WillSupplyResults.pm

filter: Statementstmt 55.7% 44 / 79 Branchbran 20.5% 14 / 68 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 81.8% 9 / 11 Podpod 100% 3 / 3 totaltotal 42.7% 71 / 166 CC 37 SCAR 45.6
CC
37
Cov
39%
set
240.0
from_asn
56.0
new
29.6
CRAP 95.8
« lib/Biblio/ILL/ISO/SupplyDetails.pm ↑ Summary lib/Biblio/ILL/ISO/ThirdPartyInfoType.pm »
1 package Biblio::ILL::ISO::WillSupplyResults;
2  
3 =head1 NAME
4  
5 Biblio::ILL::ISO::WillSupplyResults
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::ReasonWillSupply;
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::PostalAddress;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 4 ▶use Biblio::ILL::ISO::LocationInfoSequence;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 4 ▶use Biblio::ILL::ISO::ElectronicDeliveryService;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 4 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 =head1 VERSION
19  
20 Version 0.01
21  
22 =cut
23  
24 4 our $VERSION = '0.01';
25 #---------------------------------------------------------------------------
26 # Mods
27 # 0.01 - 2003.07.26 - original version
28 #---------------------------------------------------------------------------
29  
30 =head1 DESCRIPTION
31  
32 Biblio::ILL::ISO::WillSupplyResults is a derivation of Biblio::ILL::ISO::ILLASNtype.
33  
34 =head1 USES
35  
36 Biblio::ILL::ISO::ReasonWillSupply
37 Biblio::ILL::ISO::ISODate
38 Biblio::ILL::ISO::PostalAddress
39 Biblio::ILL::ISO::LocationInfoSequence
40 Biblio::ILL::ISO::ElectronicDeliveryService
41  
42 =head1 USED IN
43  
44 Biblio::ILL::ISO::ResultsExplanation
45  
46 =cut
47  
48 4 ▶BEGIN{@ISA = qw ( Biblio::ILL::ISO::ILLASNtype );} # inherit from ILLASNtype
Subroutine BEGIN: called CC=1 SCAR=0.0
49  
50 =head1 FROM THE ASN DEFINITION
51
52 Will-Supply-Results ::= EXPLICIT SEQUENCE {
53 reason-will-supply [0] ReasonWillSupply,
54 supply-date [1] ISO-Date OPTIONAL,
55 return-to-address [2] Postal-Address OPTIONAL,
56 locations [3] IMPLICIT SEQUENCE OF Location-Info OPTIONAL,
57 electronic-delivery-service [4] Electronic-Delivery-Service OPTIONAL
58 -- if present, this must be one of the services proposed by
59 -- the requester
60 }
61  
62 =cut
63  
64 =head1 METHODS
65  
66 =cut
67  
68 #---------------------------------------------------------------
69 #
70 #---------------------------------------------------------------
71 =head1
72  
73 =head2 new( $reason, [$supplydate [,$returnto [,$locations [,$electronic_delivery_service]]]] )
74  
75 Creates a new WillSupplyResults object.
76 Expects either no paramaters, or
77 a reason (Biblio::ILL::ISO::ReasonWillSupply),
78 (optionally) a supply-date (Biblio::ILL::ISO::ISODate),
79 (optionally) a return-to address (Biblio::ILL::ISO::PostalAddress),
80 (optionally) a locations sequence (Biblio::ILL::ISO::LocationInfoSequence), and
81 (optionally) an electronic delivery address (Biblio::ILL::ISO::ElectronicDeliveryService).
82  
83 =cut
84 1 ▶sub new {
Subroutine new: called CC=17 SCAR=33.9
Pod documented
85 1 my $class = shift;
86 1 my $self = {};
87  
88 1 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 1 0 1
89 1 my ($reason, $supplydate, $returnto, $locations, $electronic_delivery_service) = @_;
90  
91 1 ▶ croak "missing will-supply-result reason-will-supply" unless ($reason);
Branch: 1 branch
BranchTrueFalseTotal
unless $reason 0 1 1
92 1 ▶ croak "invalid will-supply-result reason-will-supply" unless (ref($reason) eq "Biblio::ILL::ISO::ReasonWillSupply");
Branch: 1 branch
BranchTrueFalseTotal
unless ref $reason eq "Biblio::ILL::ISO::ReasonWillSupply" 0 1 1
93  
94 1 ▶ if ($supplydate) {
Branch: 1 branch
BranchTrueFalseTotal
if ($supplydate) 1 0 1
95 1 ▶ croak "invalid supply-date" unless (ref($supplydate) eq "Biblio::ILL::ISO::ISODate");
Branch: 1 branch
BranchTrueFalseTotal
unless ref $supplydate eq "Biblio::ILL::ISO::ISODate" 0 1 1
96 }
97 1 ▶ if ($returnto) {
Branch: 1 branch
BranchTrueFalseTotal
if ($returnto) 1 0 1
98 1 ▶ croak "invalid return-to-address" unless (ref($returnto) eq "Biblio::ILL::ISO::PostalAddress");
Branch: 1 branch
BranchTrueFalseTotal
unless ref $returnto eq "Biblio::ILL::ISO::PostalAddress" 0 1 1
99 }
100 1 ▶ if ($locations) {
Branch: 1 branch
BranchTrueFalseTotal
if ($locations) 1 0 1
101 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
102 }
103 1 ▶ if ($electronic_delivery_service) {
Branch: 1 branch
BranchTrueFalseTotal
if ($electronic_delivery_service) 0 1 1
104 0 ▶ croak "invalid electronic-delivery-service" unless (ref($electronic_delivery_service) eq "Biblio::ILL::ISO::ElectronicDeliveryService");
Branch: 1 branch
BranchTrueFalseTotal
unless ref $electronic_delivery_service eq "Biblio::ILL::ISO::ElectronicDeliveryService" 0 0 0
105 }
106
107 1 $self->{"reason-will-supply"} = $reason;
108 1 ▶ $self->{"supply-date"} = $supplydate if ($supplydate);
Branch: 1 branch
BranchTrueFalseTotal
if $supplydate 1 0 1
109 1 ▶ $self->{"return-to-address"} = $returnto if ($returnto);
Branch: 1 branch
BranchTrueFalseTotal
if $returnto 1 0 1
110 1 ▶ $self->{"locations"} = $locations if ($locations);
Branch: 1 branch
BranchTrueFalseTotal
if $locations 1 0 1
111 1 ▶ $self->{"electronic-delivery-address"} = $electronic_delivery_address if ($electronic_delivery_address);
Branch: 1 branch
BranchTrueFalseTotal
if $electronic_delivery_address 0 1 1
112 }
113  
114 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
115 1 return ($self);
116 }
117  
118  
119 #---------------------------------------------------------------
120 #
121 #---------------------------------------------------------------
122 =head1
123  
124 =head2 set( $reason, [$supplydate [,$returnto [,$locations [,$electronic_delivery_service]]]] )
125  
126 Sets the object's reason-will-supply (Biblio::ILL::ISO::ReasonWillSupply),
127 (optionally) supply-date (Biblio::ILL::ISO::ISODate),
128 (optionally) return-to-address (Biblio::ILL::ISO::PostalAddress),
129 (optionally) locations (Biblio::ILL::ISO::LocationInfoSequence), and
130 (optionally) electronic-delivery-address (Biblio::ILL::ISO::ElectronicDeliveryService).
131  
132 =cut
133 0 ▶sub set {
Subroutine set: not called CC=15 SCAR=54.8
Pod documented
134 0 my $self = shift;
135  
136 0 my ($reason, $supplydate, $returnto, $locations, $electronic_delivery_service) = @_;
137  
138 0 ▶ croak "missing will-supply-result reason-will-supply" unless ($reason);
Branch: 1 branch
BranchTrueFalseTotal
unless $reason 0 0 0
139 0 ▶ croak "invalid will-supply-result reason-will-supply" unless (ref($reason) eq "Biblio::ILL::ISO::ReasonWillSupply");
Branch: 1 branch
BranchTrueFalseTotal
unless ref $reason eq "Biblio::ILL::ISO::ReasonWillSupply" 0 0 0
140  
141 0 ▶ if ($supplydate) {
Branch: 1 branch
BranchTrueFalseTotal
if ($supplydate) 0 0 0
142 0 ▶ croak "invalid supply-date" unless (ref($supplydate) eq "Biblio::ILL::ISO::ISODate");
Branch: 1 branch
BranchTrueFalseTotal
unless ref $supplydate eq "Biblio::ILL::ISO::ISODate" 0 0 0
143 }
144 0 ▶ if ($returnto) {
Branch: 1 branch
BranchTrueFalseTotal
if ($returnto) 0 0 0
145 0 ▶ croak "invalid return-to-address" unless (ref($returnto) eq "Biblio::ILL::ISO::PostalAddress");
Branch: 1 branch
BranchTrueFalseTotal
unless ref $returnto eq "Biblio::ILL::ISO::PostalAddress" 0 0 0
146 }
147 0 ▶ if ($locations) {
Branch: 1 branch
BranchTrueFalseTotal
if ($locations) 0 0 0
148 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
149 }
150 0 ▶ if ($electronic_delivery_service) {
Branch: 1 branch
BranchTrueFalseTotal
if ($electronic_delivery_service) 0 0 0
151 0 ▶ croak "invalid electronic-delivery-service" unless (ref($electronic_delivery_service) eq "Biblio::ILL::ISO::ElectronicDeliveryService");
Branch: 1 branch
BranchTrueFalseTotal
unless ref $electronic_delivery_service eq "Biblio::ILL::ISO::ElectronicDeliveryService" 0 0 0
152 }
153
154 0 $self->{"reason-will-supply"} = $reason;
155 0 ▶ $self->{"supply-date"} = $supplydate if ($supplydate);
Branch: 1 branch
BranchTrueFalseTotal
if $supplydate 0 0 0
156 0 ▶ $self->{"return-to-address"} = $returnto if ($returnto);
Branch: 1 branch
BranchTrueFalseTotal
if $returnto 0 0 0
157 0 ▶ $self->{"locations"} = $locations if ($locations);
Branch: 1 branch
BranchTrueFalseTotal
if $locations 0 0 0
158 0 ▶ $self->{"electronic-delivery-address"} = $electronic_delivery_address if ($electronic_delivery_address);
Branch: 1 branch
BranchTrueFalseTotal
if $electronic_delivery_address 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=7 SCAR=40.3
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 =~ /^reason-will-supply$/) {
Branch: 5 branches
BranchTrueFalseTotal
if ($k =~ /^reason-will-supply$/) { } 0 0 0
elsif ($k =~ /^supply-date$/) { } 0 0 0
elsif ($k =~ /^return-to-address$/) { } 0 0 0
elsif ($k =~ /^locations$/) { } 0 0 0
elsif ($k =~ /^electronic-delivery-address$/) { } 0 0 0
181 0 $self->{$k} = new Biblio::ILL::ISO::ReasonWillSupply();
182 0 $self->{$k}->from_asn($href->{$k});
183
184 } elsif ($k =~ /^supply-date$/) {
185 0 $self->{$k} = new Biblio::ILL::ISO::ISODate();
186 0 $self->{$k}->from_asn($href->{$k});
187  
188 } elsif ($k =~ /^return-to-address$/) {
189 0 $self->{$k} = new Biblio::ILL::ISO::PostalAddress();
190 0 $self->{$k}->from_asn($href->{$k});
191  
192 } elsif ($k =~ /^locations$/) {
193 0 $self->{$k} = new Biblio::ILL::ISO::LocationInfoSequence();
194 0 $self->{$k}->from_asn($href->{$k});
195  
196 } elsif ($k =~ /^electronic-delivery-address$/) {
197 0 $self->{$k} = new Biblio::ILL::ISO::ElectronicDeliveryAddress();
198 0 $self->{$k}->from_asn($href->{$k});
199  
200 } else {
201 0 croak "invalid " . ref($self) . " element: [$k]";
202 }
203  
204 }
205 0 return $self;
206 }
207  
208 =head1 SEE ALSO
209  
210 See the README for system design notes.
211 See the parent class(es) for other available methods.
212  
213 For more information on Interlibrary Loan standards (ISO 10160/10161),
214 a good place to start is:
215  
216 http://www.nlc-bnc.ca/iso/ill/main.htm
217  
218 =cut
219  
220 =head1 AUTHOR
221  
222 David Christensen, <DChristensenSPAMLESS@westman.wave.ca>
223  
224 =cut
225  
226  
227 =head1 COPYRIGHT AND LICENSE
228  
229 Copyright 2003 by David Christensen
230  
231 This library is free software; you can redistribute it and/or modify it
232 under the same terms as Perl itself.
233  
234 =cut
235  
236 4 1;
« lib/Biblio/ILL/ISO/SupplyDetails.pm ↑ Summary lib/Biblio/ILL/ISO/ThirdPartyInfoType.pm »