lib/Biblio/ILL/ISO/ElectronicDeliveryService.pm

filter: Statementstmt 65.5% 38 / 58 Branchbran 16.6% 2 / 12 Conditioncond 16.6% 1 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 83.3% 10 / 12 Podpod 100% 6 / 6 totaltotal 58.1% 57 / 98 CC 10 SCAR 26.3
CC
10
Cov
54%
from_asn
42.0
set_details
6.0
new
4.5
CRAP 13.9
« lib/Biblio/ILL/ISO/StatusReport.pm ↑ Summary lib/Biblio/ILL/ISO/ShippedVia.pm »
1 package Biblio::ILL::ISO::ElectronicDeliveryService;
2  
3 =head1 NAME
4  
5 Biblio::ILL::ISO::ElectronicDeliveryService
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::EDeliveryDetails;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 4 ▶use Biblio::ILL::ISO::ILLString;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 4 ▶use Biblio::ILL::ISO::ISOTime;
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.15 - original version
26 #---------------------------------------------------------------------------
27  
28 =head1 DESCRIPTION
29  
30 Biblio::ILL::ISO::ElectronicDeliveryService is a derivation of Biblio::ILL::ISO::ILLASNtype.
31  
32 =head1 USES
33  
34 Biblio::ILL::ISO::EDeliveryDetails
35 Biblio::ILL::ISO::ISOTime
36 Biblio::ILL::ISO::ILLString
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 # WARNING! Document-Type is not implemented...
50 #
51  
52 Electronic-Delivery-Service ::= EXPLICIT SEQUENCE {
53 -- the first four parameters are intended to be used in an automated
54 -- environment
55 e-delivery-service [0] IMPLICIT E-Delivery-Service OPTIONAL,
56 document-type [1] IMPLICIT Document-Type OPTIONAL,
57 e-delivery-description [4] ILL-String OPTIONAL,
58 -- holds a human readable name or description of the
59 -- required electronic delivery service and document type;
60 -- this may also be used to identify an electronic delivery
61 -- service for which there is no object identifier.
62 -- This parameter may be present instead of, or in addition
63 -- to, the previous 4 parameters
64 e-delivery-details [5] CHOICE {
65 e-delivery-address [0] IMPLICIT System-Address,
66 e-delivery-id [1] IMPLICIT System-Id
67 }
68 name-or-code [6] ILL-String OPTIONAL,
69 -- holds a human-readable identifier or correlation
70 -- information for the document as shipped, e.g. a directory
71 -- and/or file name or message-id
72 delivery-time [7] IMPLICIT ISO-Time OPTIONAL
73 -- holds the requester's preferred delivery time or
74 -- the responder's proposed or actual delivery time
75 }
76  
77 =cut
78  
79 =head1 METHODS
80  
81 =cut
82 #---------------------------------------------------------------
83 #
84 #---------------------------------------------------------------
85 =head1
86  
87 =head2 new( [$e_delivery_details] )
88  
89 Creates a new ElectronicDeliveryService object.
90 Expects either no paramaters or
91 an e-delivery-details (Biblio::ILL::ISO::EDeliveryDetails).
92  
93 =cut
94 2 ▶sub new {
Subroutine new: called CC=4 SCAR=15.0
Pod documented
95 2 my $class = shift;
96 2 my $self = {};
97  
98 2 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 2 0 2
99 # if there's anything, it's the one mandatory field....
100 2 my $objref = shift;
101
102 2 ▶ if (ref($objref) eq "Biblio::ILL::ISO::EDeliveryDetails") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $objref eq 'Biblio::ILL::ISO::EDeliveryDetails') { } 2 0 2
103 2 $self->{"e-delivery-details"} = $objref;
104 } else {
105 0 croak "Invalid e-delivery-details";
106 }
107 }
108  
109 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
110 2 return ($self);
111 }
112  
113  
114 #---------------------------------------------------------------
115 #
116 #---------------------------------------------------------------
117 =head1
118  
119 =head2 from_asn($href)
120  
121 Given a properly formatted hash, builds the object.
122  
123 =cut
124 0 ▶sub from_asn {
Subroutine from_asn: not called CC=6 SCAR=37.4
Pod documented
125 0 my $self = shift;
126 0 my $href = shift;
127  
128 0 foreach my $k (keys %$href) {
129 0 print ref($self) . "...$k\n";
130  
131 0 ▶ if (($k =~ /^e-delivery-description$/)
Branch: 3 branches
BranchTrueFalseTotal
if ($k =~ /^e-delivery-description$/ or $k =~ /^name-or-code$/) { } 0 0 0
elsif ($k =~ /^e-delivery-details$/) { } 0 0 0
elsif ($k =~ /^delivery-time$/) { } 0 0 0
Condition0%0/3
$k =~ /^e-delivery-description$/ or $k =~ /^name-or-code$/
l!l&&r!l&&!r
000
MC/DC0%0/2
$k =~ /^e-delivery-description$/ or $k =~ /^name-or-code$/
$k =~ /^e-delivery-description$/ $k =~ /^name-or-code$/
Truth table0%0/3
A or B
A= $k =~ /^e-delivery-description$/B= $k =~ /^name-or-code$/
ABresult
1X1
011
000
132 || ($k =~ /^name-or-code$/)
133 ) {
134 0 $self->{$k} = new Biblio::ILL::ISO::ILLString();
135 0 $self->{$k}->from_asn($href->{$k});
136  
137 } elsif ($k =~ /^e-delivery-details$/) {
138 0 $self->{$k} = new Biblio::ILL::ISO::EDeliveryDetails();
139 0 $self->{$k}->from_asn($href->{$k});
140  
141 } elsif ($k =~ /^delivery-time$/) {
142 0 $self->{$k} = new Biblio::ILL::ISO::ISOTime();
143 0 $self->{$k}->from_asn($href->{$k});
144  
145 } else {
146 0 croak "invalid " . ref($self) . " element: [$k]";
147 }
148  
149 }
150 0 return $self;
151 }
152  
153 #---------------------------------------------------------------
154 #
155 #---------------------------------------------------------------
156 =head1
157  
158 =head2 set_description($s)
159  
160 Sets the object's e-delivery-description.
161 Expects a text string.
162  
163 =cut
164 2 ▶sub set_description {
Subroutine set_description: called CC=1 SCAR=0.0
Pod documented
165 2 my $self = shift;
166 2 my ($s) = @_;
167  
168 2 $self->{"e-delivery-description"} = new Biblio::ILL::ISO::ILLString($s);
169 2 return;
170 }
171  
172 #---------------------------------------------------------------
173 #
174 #---------------------------------------------------------------
175 =head1
176  
177 =head2 set_details($e_delivery_details)
178  
179 Sets the object's e-delivery-details.
180 Expects a valid Biblio::ILL::ISO::EDeliveryDetails.
181  
182 =cut
183 0 ▶sub set_details {
Subroutine set_details: not called CC=2 SCAR=17.9
Pod documented
184 0 my $self = shift;
185 0 my $objref = shift;
186
187 0 ▶ if (ref($objref) eq "Biblio::ILL::ISO::EDeliveryDetails") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $objref eq 'Biblio::ILL::ISO::EDeliveryDetails') { } 0 0 0
188 0 $self->{"e-delivery-details"} = $objref;
189 } else {
190 0 croak "Invalid e-delivery-details";
191 }
192  
193 0 return;
194 }
195  
196  
197 #---------------------------------------------------------------
198 #
199 #---------------------------------------------------------------
200 =head1
201  
202 =head2 set_name_or_code($s)
203  
204 Sets the object's name-or-code.
205 Expects a text string.
206  
207 =cut
208 2 ▶sub set_name_or_code {
Subroutine set_name_or_code: called CC=1 SCAR=0.0
Pod documented
209 2 my $self = shift;
210 2 my ($s) = @_;
211  
212 2 $self->{"name-or-code"} = new Biblio::ILL::ISO::ILLString($s);
213 2 return;
214 }
215  
216 #---------------------------------------------------------------
217 #
218 #---------------------------------------------------------------
219 =head1
220  
221 =head2 set_delivery_time($s)
222  
223 Sets the object's delivery-time.
224 Expects a text string in time format (HHMMSS).
225  
226 =cut
227 2 ▶sub set_delivery_time {
Subroutine set_delivery_time: called CC=1 SCAR=0.0
Pod documented
228 2 my $self = shift;
229 2 my ($s) = @_;
230  
231 2 $self->{"delivery-time"} = new Biblio::ILL::ISO::ISOTime($s);
232 2 return;
233 }
234  
235 =head1 SEE ALSO
236  
237 See the README for system design notes.
238 See the parent class(es) for other available methods.
239  
240 For more information on Interlibrary Loan standards (ISO 10160/10161),
241 a good place to start is:
242  
243 http://www.nlc-bnc.ca/iso/ill/main.htm
244  
245 =cut
246  
247 =head1 AUTHOR
248  
249 David Christensen, <DChristensenSPAMLESS@westman.wave.ca>
250  
251 =cut
252  
253  
254 =head1 COPYRIGHT AND LICENSE
255  
256 Copyright 2003 by David Christensen
257  
258 This library is free software; you can redistribute it and/or modify it
259 under the same terms as Perl itself.
260  
261 =cut
262  
263 4 1;
« lib/Biblio/ILL/ISO/StatusReport.pm ↑ Summary lib/Biblio/ILL/ISO/ShippedVia.pm »