lib/Biblio/ILL/ISO/Request.pm

filter: Statementstmt 75.6% 155 / 205 Branchbran 35.9% 46 / 128 Conditioncond 5.5% 1 / 18 MC/DCmcdc 0.0% 0 / 11 Subroutinesub 93.3% 28 / 30 Podpod 100% 27 / 27 totaltotal 61.3% 257 / 419 CC 74 SCAR 51.9
CC
74
Cov
58%
from_asn
702.0
as_pretty_string
12.0
set_ILL_service_type_sequence
4.2
CRAP 179.7
« lib/Biblio/ILL/ISO/HistoryReport.pm ↑ Summary lib/Biblio/ILL/ISO/ItemId.pm »
1 package Biblio::ILL::ISO::Request;
2  
3 =head1 NAME
4  
5 Biblio::ILL::ISO::Request - Perl extension for handling ISO 10161 interlibrary loan ILL-Request messages
6  
7 =cut
8  
9 2 ▶use Biblio::ILL::ISO::ISO;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 2 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 =head1 VERSION
13  
14 Version 0.01
15  
16 =cut
17  
18 2 our $VERSION = '0.01';
19 #---------------------------------------------------------------------------
20 # Mods
21 # 0.01 - 2003.07.15 - original version
22 #---------------------------------------------------------------------------
23  
24 =head1 DESCRIPTION
25  
26 Biblio::ILL::ISO::Request is a derivation of the abstract
27 Biblio::ILL::ISO::ISO object, and handles the ILL-Request message type.
28  
29 =head1 EXPORT
30  
31 None.
32  
33 =head1 ERROR HANDLING
34  
35 Each of the set_() methods will croak on missing or invalid parameters.
36  
37 =cut
38  
39 2 ▶BEGIN{@ISA = qw ( Biblio::ILL::ISO::ISO ); }
Subroutine BEGIN: called CC=1 SCAR=0.0
40  
41 =head1 FROM THE ASN DEFINITION
42
43 ILL-Request ::= [APPLICATION 1] EXPLICIT SEQUENCE {
44 protocol-version-num [0] IMPLICIT INTEGER, -- {
45 -- version-1 (1),
46 -- version-2 (2)
47 --},
48 transaction-id [1] IMPLICIT Transaction-Id,
49 service-date-time [2] IMPLICIT Service-Date-Time,
50 requester-id [3] IMPLICIT System-Id OPTIONAL,
51 -- mandatory when using store-and-forward communications
52 -- optional when using connection-oriented communications
53 responder-id [4] IMPLICIT System-Id OPTIONAL,
54 -- mandatory when using store-and-forward communications
55 -- optional when using connection-oriented communications
56 transaction-type [5] IMPLICIT Transaction-Type, --DEFAULT 1,
57 delivery-address [6] IMPLICIT Delivery-Address OPTIONAL,
58 delivery-service Delivery-Service OPTIONAL,
59 billing-address [8] IMPLICIT Delivery-Address OPTIONAL,
60 iLL-service-type [9] IMPLICIT SEQUENCE OF ILL-Service-Type, -- SIZE (1..5)
61 -- this sequence is a list, in order of preference
62 -- DC - 'EXTERNAL' is not supported in Convert::ASN1
63 -- responder-specific-service [10] EXTERNAL OPTIONAL,
64 -- -- use direct reference style
65 requester-optional-messages [11] IMPLICIT Requester-Optional-Messages-Type,
66 search-type [12] IMPLICIT Search-Type OPTIONAL,
67 supply-medium-info-type [13] IMPLICIT SEQUENCE OF Supply-Medium-Info-Type OPTIONAL, -- SIZE (1..7)
68 -- this sequence is a list, in order of preference,
69 -- with a maximum number of 7 entries
70 place-on-hold [14] IMPLICIT Place-On-Hold-Type, --DEFAULT 3,
71 client-id [15] IMPLICIT Client-Id OPTIONAL,
72 item-id [16] IMPLICIT Item-Id,
73 -- DC - 'EXTERNAL' definition (see Supplemental-Item-Description)
74 -- supplemental-item-description [17] IMPLICIT Supplemental-Item-Description OPTIONAL,
75 cost-info-type [18] IMPLICIT Cost-Info-Type OPTIONAL,
76 copyright-compliance [19] ILL-String OPTIONAL,
77 third-party-info-type [20] IMPLICIT Third-Party-Info-Type OPTIONAL,
78 -- mandatory when initiating a FORWARD service or an
79 -- ILL-REQUEST service for a partitioned ILL sub-
80 -- transaction or when initiating an ILL-REQUEST service for
81 -- an ILL sub-transaction if the received ILL-REQUEST
82 -- included an "already-tried-list";optional otherwise
83 retry-flag [21] IMPLICIT BOOLEAN, -- DEFAULT FALSE,
84 forward-flag [22] IMPLICIT BOOLEAN, -- DEFAULT FALSE,
85 requester-note [46] ILL-String OPTIONAL,
86 forward-note [47] ILL-String OPTIONAL,
87 iLL-request-extensions [49] IMPLICIT SEQUENCE OF Extension OPTIONAL
88 --iLL-request-extensions [49] IMPLICIT SEQUENCE OF Extension
89 }
90
91 =cut
92  
93 =head1 CONSTRUCTORS
94  
95 new()
96  
97 Base constructor for the class. It just returns a completely
98 empty message object, which you'll need to populate with the
99 various set_() methods, or use the read() method to read an
100 ILL-Request message from a file (followed by a call to
101 from_asn() to turn the read's returned hash into a proper
102 Request message.
103  
104 The constructor also initializes the Convert::ASN1 if it
105 hasn't been initialized.
106  
107 =cut
108 #---------------------------------------------------------------
109 #
110 #---------------------------------------------------------------
111 2 ▶sub new {
Subroutine new: called CC=3 SCAR=11.2
Pod documented
112 2 my $class = shift;
113 2 my $self = {};
114  
115 2 ▶ Biblio::ILL::ISO::ISO::_init() if (not $Biblio::ILL::ISO::ISO::_asn_initialized);
Branch: 1 branch
BranchTrueFalseTotal
unless $Biblio::ILL::ISO::ISO::_asn_initialized 1 1 2
116 2 $self->{"ASN_TYPE"} = "ILL-Request";
117  
118 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
119 2 return ($self);
120 }
121  
122  
123 #---------------------------------------------------------------
124 #
125 #---------------------------------------------------------------
126 0 ▶sub as_pretty_string {
Subroutine as_pretty_string: not called CC=3 SCAR=24.8
Pod documented
127 0 my $self = shift;
128  
129 0 foreach my $key (sort keys %$self) {
130 0 ▶ if ($key ne "ASN_TYPE") {
Branch: 1 branch
BranchTrueFalseTotal
if ($key ne "ASN_TYPE") 0 0 0
131 0 print "\n[$key]\n";
132 0 print $self->{$key}->as_pretty_string();
133 }
134 }
135 0 return;
136 }
137  
138 #---------------------------------------------------------------
139 # This will return a structure usable by Convert::ASN1
140 #---------------------------------------------------------------
141 1 ▶sub as_asn {
Subroutine as_asn: called CC=3 SCAR=11.0
Pod documented
142 1 my $self = shift;
143  
144 1 my %h = ();
145 1 foreach my $key (sort keys %$self) {
146 24 ▶ if ($key ne "ASN_TYPE") {
Branch: 1 branch
BranchTrueFalseTotal
if ($key ne "ASN_TYPE") 23 1 24
147 #print "\n[$key]\n";
148 23 $h{$key} = $self->{$key}->as_asn();
149 }
150 }
151 1 return \%h;
152 }
153  
154 =head1 METHODS
155  
156 For any example code, assume the following:
157 my $msg = new Biblio::ILL::ISO::Request;
158  
159 =cut
160  
161 #---------------------------------------------------------------
162 #
163 #---------------------------------------------------------------
164 =head1
165  
166 =head2 from_asn($href)
167  
168 To read a message from a file, use the following:
169  
170 my $href = $msg->read("msg_01.request.ber");
171 $msg = $msg->from_asn($href);
172  
173 The from_asn() method turns the hash returned from read() into
174 a proper message-type object.
175  
176 =cut
177 0 ▶sub from_asn {
Subroutine from_asn: not called CC=26 SCAR=65.5
Pod documented
178 0 my $self = shift;
179 0 my $href = shift;
180  
181 0 foreach my $k (keys %$href) {
182  
183 0 ▶ if ($k =~ /^protocol-version-num$/) {
Branch: 19 branches
BranchTrueFalseTotal
if ($k =~ /^protocol-version-num$/) { } 0 0 0
elsif ($k =~ /^transaction-id$/) { } 0 0 0
elsif ($k =~ /^service-date-time$/) { } 0 0 0
elsif ($k =~ /^requester-id$/ or $k =~ /^responder-id$/) { } 0 0 0
elsif ($k =~ /^transaction-type$/) { } 0 0 0
elsif ($k =~ /^delivery-service$/) { } 0 0 0
elsif ($k =~ /^billing-address$/ or $k =~ /^delivery-address$/) { } 0 0 0
elsif ($k =~ /^iLL-service-type$/) { } 0 0 0
elsif ($k =~ /^requester-optional-messages$/) { } 0 0 0
elsif ($k =~ /^search-type$/) { } 0 0 0
elsif ($k =~ /^supply-medium-info-type$/) { } 0 0 0
elsif ($k =~ /^place-on-hold$/) { } 0 0 0
elsif ($k =~ /^client-id$/) { } 0 0 0
elsif ($k =~ /^item-id$/) { } 0 0 0
elsif ($k =~ /^cost-info-type$/) { } 0 0 0
elsif ($k =~ /^copyright-compliance$/ or $k =~ /^requester-note$/ or $k =~ /^forward-note$/) { } 0 0 0
elsif ($k =~ /^third-party-info-type$/) { } 0 0 0
elsif ($k =~ /^retry-flag$/ or $k =~ /^forward-flag$/) { } 0 0 0
elsif ($k =~ /^iLL-request-extensions$/) { } 0 0 0
184 0 $self->{$k} = new Biblio::ILL::ISO::ProtocolVersionNum();
185 0 $self->{$k}->from_asn($href->{$k});
186  
187 } elsif ($k =~ /^transaction-id$/) {
188 0 $self->{$k} = new Biblio::ILL::ISO::TransactionId();
189 0 $self->{$k}->from_asn($href->{$k});
190  
191 } elsif ($k =~ /^service-date-time$/) {
192 0 $self->{$k} = new Biblio::ILL::ISO::ServiceDateTime();
193 0 $self->{$k}->from_asn($href->{$k});
194  
195 ▶ } elsif (($k =~ /^requester-id$/)
Condition0%0/3
$k =~ /^requester-id$/ or $k =~ /^responder-id$/
l!l&&r!l&&!r
000
MC/DC0%0/2
$k =~ /^requester-id$/ or $k =~ /^responder-id$/
$k =~ /^requester-id$/ $k =~ /^responder-id$/
Truth table0%0/3
A or B
A= $k =~ /^requester-id$/B= $k =~ /^responder-id$/
ABresult
1X1
011
000
196 || ($k =~ /^responder-id$/)
197 ) {
198 0 $self->{$k} = new Biblio::ILL::ISO::SystemId();
199 0 $self->{$k}->from_asn($href->{$k});
200  
201 } elsif ($k =~ /^transaction-type$/) {
202 0 $self->{$k} = new Biblio::ILL::ISO::TransactionType();
203 0 $self->{$k}->from_asn($href->{$k});
204  
205 } elsif ($k =~ /^delivery-service$/) {
206 0 $self->{$k} = new Biblio::ILL::ISO::DeliveryService();
207 0 $self->{$k}->from_asn($href->{$k});
208  
209 ▶ } elsif (($k =~ /^billing-address$/)
Condition0%0/3
$k =~ /^billing-address$/ or $k =~ /^delivery-address$/
l!l&&r!l&&!r
000
MC/DC0%0/2
$k =~ /^billing-address$/ or $k =~ /^delivery-address$/
$k =~ /^billing-address$/ $k =~ /^delivery-address$/
Truth table0%0/3
A or B
A= $k =~ /^billing-address$/B= $k =~ /^delivery-address$/
ABresult
1X1
011
000
210 || ($k =~ /^delivery-address$/)
211 ) {
212 0 $self->{$k} = new Biblio::ILL::ISO::DeliveryAddress();
213 0 $self->{$k}->from_asn($href->{$k});
214  
215 } elsif ($k =~ /^iLL-service-type$/) {
216 0 $self->{$k} = new Biblio::ILL::ISO::ILLServiceTypeSequence();
217 0 $self->{$k}->from_asn($href->{$k});
218  
219 } elsif ($k =~ /^requester-optional-messages$/) {
220 0 $self->{$k} = new Biblio::ILL::ISO::RequesterOptionalMessageType();
221 0 $self->{$k}->from_asn($href->{$k});
222  
223 } elsif ($k =~ /^search-type$/) {
224 0 $self->{$k} = new Biblio::ILL::ISO::SearchType();
225 0 $self->{$k}->from_asn($href->{$k});
226  
227 } elsif ($k =~ /^supply-medium-info-type$/) {
228 0 $self->{$k} = new Biblio::ILL::ISO::SupplyMediumInfoTypeSequence();
229 0 $self->{$k}->from_asn($href->{$k});
230  
231 } elsif ($k =~ /^place-on-hold$/) {
232 0 $self->{$k} = new Biblio::ILL::ISO::PlaceOnHoldType();
233 0 $self->{$k}->from_asn($href->{$k});
234  
235 } elsif ($k =~ /^client-id$/) {
236 0 $self->{$k} = new Biblio::ILL::ISO::ClientId();
237 0 $self->{$k}->from_asn($href->{$k});
238  
239 } elsif ($k =~ /^item-id$/) {
240 0 $self->{$k} = new Biblio::ILL::ISO::ItemId();
241 0 $self->{$k}->from_asn($href->{$k});
242  
243 } elsif ($k =~ /^cost-info-type$/) {
244 0 $self->{$k} = new Biblio::ILL::ISO::CostInfoType();
245 0 $self->{$k}->from_asn($href->{$k});
246  
247 ▶ } elsif (($k =~ /^copyright-compliance$/)
Condition0%0/6
$k =~ /^copyright-compliance$/ or $k =~ /^requester-note$/ or $k =~ /^forward-note$/
l!l&&r!l&&!r
000
$k =~ /^copyright-compliance$/ or $k =~ /^requester-note$/
l!l&&r!l&&!r
000
MC/DC0%0/3
$k =~ /^copyright-compliance$/ or $k =~ /^requester-note$/ or $k =~ /^forward-note$/
$k =~ /^copyright-compliance$/ $k =~ /^requester-note$/ $k =~ /^forward-note$/
Truth table0%0/4
A or B or C
A= $k =~ /^copyright-compliance$/B= $k =~ /^requester-note$/C= $k =~ /^forward-note$/
ABCresult
1XX1
01X1
0011
0000
248 || ($k =~ /^requester-note$/)
249 || ($k =~ /^forward-note$/)
250 ) {
251 0 $self->{$k} = new Biblio::ILL::ISO::ILLString();
252 0 $self->{$k}->from_asn($href->{$k});
253  
254 } elsif ($k =~ /^third-party-info-type$/) {
255 0 $self->{$k} = new Biblio::ILL::ISO::ThirdPartyInfoType();
256 0 $self->{$k}->from_asn($href->{$k});
257  
258 ▶ } elsif (($k =~ /^retry-flag$/)
Condition0%0/3
$k =~ /^retry-flag$/ or $k =~ /^forward-flag$/
l!l&&r!l&&!r
000
MC/DC0%0/2
$k =~ /^retry-flag$/ or $k =~ /^forward-flag$/
$k =~ /^retry-flag$/ $k =~ /^forward-flag$/
Truth table0%0/3
A or B
A= $k =~ /^retry-flag$/B= $k =~ /^forward-flag$/
ABresult
1X1
011
000
259 || ($k =~ /^forward-flag$/)
260 ) {
261 0 $self->{$k} = new Biblio::ILL::ISO::Flag();
262 0 $self->{$k}->from_asn($href->{$k});
263  
264 } elsif ($k =~ /^iLL-request-extensions$/) {
265 0 print "---------- Found iLL-request-extensions ----------\n";
266 0 print "k = [$k]\n---------------------------------------------------\n";
267 #$self->{$k} = new Biblio::ILL::ISO::Extension();
268 #$self->{$k}->from_asn($href->{$k});
269  
270 } else {
271 0 croak "invalid " . ref($self) . " element: [$k]";
272 }
273  
274 }
275 0 return $self;
276 }
277  
278 #---------------------------------------------------------------
279 #
280 #---------------------------------------------------------------
281 =head1
282  
283 =head2 set_protocol_version_num($pvn)
284  
285 Sets the protocol version number.
286 Acceptable parameter values are the strings:
287 version-1
288 version-2
289  
290 =cut
291 1 ▶sub set_protocol_version_num {
Subroutine set_protocol_version_num: called CC=2 SCAR=7.0
Pod documented
292 1 my $self = shift;
293 1 my ($parm) = shift;
294  
295 1 ▶ croak "missing protocol-version-num" unless $parm;
Branch: 1 branch
BranchTrueFalseTotal
unless $parm 0 1 1
296  
297 1 $self->{"protocol-version-num"} = new Biblio::ILL::ISO::ProtocolVersionNum($parm);
298  
299 1 return;
300 }
301  
302 #---------------------------------------------------------------
303 #
304 #---------------------------------------------------------------
305 =head1
306  
307 =head2 set_transaction_id($tid)
308  
309 Sets the message's transaction-id.
310 Expects a valid Biblio::ILL::ISO::TransactionId.
311  
312 my $tid = new Biblio::ILL::ISO::TransactionId("PLS","001","",
313 new Biblio::ILL::ISO::SystemId("MWPL"));
314 $msg->set_transaction_id($tid);
315  
316 This is a mandatory field.
317  
318 =cut
319 1 ▶sub set_transaction_id {
Subroutine set_transaction_id: called CC=3 SCAR=11.2
Pod documented
320 1 my $self = shift;
321 1 my ($parm) = shift;
322  
323 1 ▶ croak "missing transaction-id" unless $parm;
Branch: 1 branch
BranchTrueFalseTotal
unless $parm 0 1 1
324 1 ▶ croak "invalid transaction-id" unless (ref($parm) eq "Biblio::ILL::ISO::TransactionId");
Branch: 1 branch
BranchTrueFalseTotal
unless ref $parm eq "Biblio::ILL::ISO::TransactionId" 0 1 1
325  
326 1 $self->{"transaction-id"} = $parm;
327  
328 1 return;
329 }
330  
331 #---------------------------------------------------------------
332 #
333 #---------------------------------------------------------------
334 =head1
335  
336 =head2 set_service_date_time($sdt)
337  
338 Sets the message's service-date-time.
339 Expects a valid Biblio::ILL::ISO::ServiceDateTime.
340  
341 my $dt_this = new Biblio::ILL::ISO::DateTime("20030623","114400");
342 my $dt_orig = new Biblio::ILL::ISO::DateTime("20030623","114015")
343 my $sdt = new Biblio::ILL::ISO::ServiceDateTime( $dt_this, $dt_orig);
344 $msg->set_service_date_time($sdt);
345  
346 This is a mandatory field.
347  
348 =cut
349 1 ▶sub set_service_date_time {
Subroutine set_service_date_time: called CC=3 SCAR=11.2
Pod documented
350 1 my $self = shift;
351 1 my ($sdt) = shift;
352  
353 1 ▶ croak "missing service-date-time" unless $sdt;
Branch: 1 branch
BranchTrueFalseTotal
unless $sdt 0 1 1
354 1 ▶ croak "invalid service-date-time" unless (ref($sdt) eq "Biblio::ILL::ISO::ServiceDateTime");
Branch: 1 branch
BranchTrueFalseTotal
unless ref $sdt eq "Biblio::ILL::ISO::ServiceDateTime" 0 1 1
355  
356 1 $self->{"service-date-time"} = $sdt;
357  
358 1 return;
359 }
360  
361 #---------------------------------------------------------------
362 #
363 #---------------------------------------------------------------
364 =head1
365  
366 =head2 set_requester_id($reqid)
367  
368 Sets the message's requester-id.
369 Expects a valid Biblio::ILL::ISO::SystemId.
370  
371 my $reqid = new Biblio::ILL::ISO::SystemId();
372 $reqid->set_person_name("David A. Christensen");
373 $msg->set_requester_id($reqid);
374  
375 This is a mandatory field.
376  
377 =cut
378 1 ▶sub set_requester_id {
Subroutine set_requester_id: called CC=3 SCAR=11.2
Pod documented
379 1 my $self = shift;
380 1 my ($parm) = shift;
381  
382 1 ▶ croak "missing requester-id" unless $parm;
Branch: 1 branch
BranchTrueFalseTotal
unless $parm 0 1 1
383 1 ▶ croak "invalid requester-id" unless (ref($parm) eq "Biblio::ILL::ISO::SystemId");
Branch: 1 branch
BranchTrueFalseTotal
unless ref $parm eq "Biblio::ILL::ISO::SystemId" 0 1 1
384  
385 1 $self->{"requester-id"} = $parm;
386  
387 1 return;
388 }
389  
390 #---------------------------------------------------------------
391 #
392 #---------------------------------------------------------------
393 =head1
394  
395 =head2 set_responder_id($resid)
396  
397 Sets the message's responder-id.
398 Expects a valid Biblio::ILL::ISO::SystemId.
399  
400 my $resid = new Biblio::ILL::ISO::SystemId("MWPL");
401 $msg->set_responder_id($resid);
402  
403 This is an optional field.
404  
405 =cut
406 1 ▶sub set_responder_id {
Subroutine set_responder_id: called CC=3 SCAR=11.2
Pod documented
407 1 my $self = shift;
408 1 my ($parm) = shift;
409  
410 1 ▶ croak "missing responder-id" unless $parm;
Branch: 1 branch
BranchTrueFalseTotal
unless $parm 0 1 1
411 1 ▶ croak "invalid responder-id" unless (ref($parm) eq "Biblio::ILL::ISO::SystemId");
Branch: 1 branch
BranchTrueFalseTotal
unless ref $parm eq "Biblio::ILL::ISO::SystemId" 0 1 1
412  
413 1 $self->{"responder-id"} = $parm;
414  
415 1 return;
416 }
417  
418 #---------------------------------------------------------------
419 #
420 #---------------------------------------------------------------
421 =head1
422  
423 =head2 set_transaction_type($tt)
424  
425 Sets the message's transaction-type.
426 Expects a valid Biblio::ILL::ISO::TransactionType.
427  
428 my $tt = new Biblio::ILL::ISO::TransactionType("simple");
429 $msg->set_transaction_type($tt);
430  
431 This is a mandatory field.
432  
433 =cut
434 1 ▶sub set_transaction_type {
Subroutine set_transaction_type: called CC=3 SCAR=11.2
Pod documented
435 1 my $self = shift;
436 1 my ($parm) = shift;
437  
438 1 ▶ $parm = new Biblio::ILL::ISO::TransactionType("simple") unless ($parm);
Branch: 1 branch
BranchTrueFalseTotal
unless $parm 0 1 1
439  
440 1 ▶ croak "invalid transaction-type" unless (ref($parm) eq "Biblio::ILL::ISO::TransactionType");
Branch: 1 branch
BranchTrueFalseTotal
unless ref $parm eq "Biblio::ILL::ISO::TransactionType" 0 1 1
441  
442 1 $self->{"transaction-type"} = $parm;
443  
444 1 return;
445 }
446  
447 #---------------------------------------------------------------
448 #
449 #---------------------------------------------------------------
450 =head1
451  
452 =head2 set_delivery_address($da)
453  
454 Sets the message's delivery-address.
455 Expects a valid Biblio::ILL::ISO::DeliveryAddress.
456  
457 my $sa = new Biblio::ILL::ISO::SystemAddress("SMTP","DChristens\@gov.mb.ca")'
458 my $pa = new Biblio::ILL::ISO::PostalAddress("Manitoba Public Library Services",
459 "",
460 "Unit 200",
461 "1525 First Street South",
462 "",
463 "Brandon",
464 "MB",
465 "CANADA",
466 "R7A 7A1"
467 )
468 my $da = new Biblio::ILL::ISO::DeliveryAddress($sa, $pa);
469 $msg->set_delivery_address($da);
470  
471 This is an optional field.
472  
473 =cut
474 1 ▶sub set_delivery_address {
Subroutine set_delivery_address: called CC=3 SCAR=11.2
Pod documented
475 1 my $self = shift;
476 1 my ($parm) = shift;
477  
478 1 ▶ croak "missing delivery-address" unless $parm;
Branch: 1 branch
BranchTrueFalseTotal
unless $parm 0 1 1
479 1 ▶ croak "invalid delivery-address" unless (ref($parm) eq "Biblio::ILL::ISO::DeliveryAddress");
Branch: 1 branch
BranchTrueFalseTotal
unless ref $parm eq "Biblio::ILL::ISO::DeliveryAddress" 0 1 1
480  
481 1 $self->{"delivery-address"} = $parm;
482  
483 1 return;
484 }
485  
486 #---------------------------------------------------------------
487 #
488 #---------------------------------------------------------------
489 =head1
490  
491 =head2 set_delivery_service($ds)
492  
493 Sets the message's delivery-service.
494 Expects a valid Biblio::ILL::ISO::DeliveryService.
495  
496 my $tm = new Biblio::ILL::ISO::TransportationMode("Canada Post")
497 my $ds = new Biblio::ILL::ISO::DeliveryService( $tm );
498 $msg->set_delivery_service($ds);
499  
500 This is an optional field.
501  
502 =cut
503 1 ▶sub set_delivery_service {
Subroutine set_delivery_service: called CC=3 SCAR=11.2
Pod documented
504 1 my $self = shift;
505 1 my ($parm) = shift;
506  
507 1 ▶ croak "missing delivery-service" unless $parm;
Branch: 1 branch
BranchTrueFalseTotal
unless $parm 0 1 1
508 1 ▶ croak "invalid delivery-service" unless (ref($parm) eq "Biblio::ILL::ISO::DeliveryService");
Branch: 1 branch
BranchTrueFalseTotal
unless ref $parm eq "Biblio::ILL::ISO::DeliveryService" 0 1 1
509  
510 1 $self->{"delivery-service"} = $parm;
511  
512 1 return;
513 }
514  
515 #---------------------------------------------------------------
516 #
517 #---------------------------------------------------------------
518 =head1
519  
520 =head2 set_billing_address($ba)
521  
522 Sets the message's billing-address.
523 Expecs a valid Biblio::ILL::ISO::DeliveryAddress.
524  
525 my $sa = new Biblio::ILL::ISO::SystemAddress("SMTP","DChristens\@gov.mb.ca")'
526 my $pa = new Biblio::ILL::ISO::PostalAddress("Manitoba Public Library Services",
527 "",
528 "Unit 200",
529 "1525 First Street South",
530 "",
531 "Brandon",
532 "MB",
533 "CANADA",
534 "R7A 7A1"
535 )
536 my $ba = new Biblio::ILL::ISO::DeliveryAddress($sa, $pa);
537 $msg->set_delivery_address($ba);
538  
539 This is an optional field.
540  
541 =cut
542 1 ▶sub set_billing_address {
Subroutine set_billing_address: called CC=3 SCAR=11.2
Pod documented
543 1 my $self = shift;
544 1 my ($parm) = shift;
545  
546 1 ▶ croak "missing billing-address" unless $parm;
Branch: 1 branch
BranchTrueFalseTotal
unless $parm 0 1 1
547 1 ▶ croak "invalid billing-address" unless (ref($parm) eq "Biblio::ILL::ISO::DeliveryAddress");
Branch: 1 branch
BranchTrueFalseTotal
unless ref $parm eq "Biblio::ILL::ISO::DeliveryAddress" 0 1 1
548  
549 1 $self->{"billing-address"} = $parm;
550  
551 1 return;
552 }
553  
554 #---------------------------------------------------------------
555 #
556 #---------------------------------------------------------------
557 =head1
558  
559 =head2 set_ILL_service_type_sequence($ists)
560  
561 Sets the message's iLL-service-type sequence.
562 Expects a valid Biblio::ILL::ISO::ILLServiceTypeSequence.
563  
564 my $ist1 = new Biblio::ILL::ISO::ILLServiceType("loan");
565 my $ist2 = new Biblio::ILL::ISO::ILLServiceType("copy-non-returnable");
566 # You can pass an array of ILLServiceType(s)
567 my $ists = new Biblio::ILL::ISO::ILLServiceTypeSequence( $ist1, $ist2 );
568
569 #example of adding to a sequence_of
570 $ists->add(new Biblio::ILL::ISO::ILLServiceType("locations"));
571  
572 $msg->set_ILL_service_type_sequence($ists);
573  
574 This is a mandatory field.
575  
576 =cut
577 1 ▶sub set_ILL_service_type_sequence {
Subroutine set_ILL_service_type_sequence: called CC=4 SCAR=14.3
Pod documented
578 1 my $self = shift;
579 1 my ($parm) = shift;
580  
581 1 ▶ croak "missing iLL-service-type sequence" unless $parm;
Branch: 1 branch
BranchTrueFalseTotal
unless $parm 0 1 1
582 1 ▶ croak "invalid iLL-service-type sequence" unless (ref($parm) eq "Biblio::ILL::ISO::ILLServiceTypeSequence");
Branch: 1 branch
BranchTrueFalseTotal
unless ref $parm eq "Biblio::ILL::ISO::ILLServiceTypeSequence" 0 1 1
583 1 ▶ croak "too many iLL-service-type in the sequence (max 5)" if ($parm->count() > 5);
Branch: 1 branch
BranchTrueFalseTotal
if $parm->count > 5 0 1 1
584  
585 1 $self->{"iLL-service-type"} = $parm;
586  
587 1 return;
588 }
589  
590 #---------------------------------------------------------------
591 #
592 #---------------------------------------------------------------
593 =head1
594  
595 =head2 set_requester_optional_messages($rom)
596  
597 Sets the message's requester-optional-messages.
598 Expects a valid Biblio::ILL::ISO::RequesterOptionalMessageType.
599  
600 my $rom = new Biblio::ILL::ISO::RequesterOptionalMessageType(1,
601 1,
602 "desires",
603 "requires"
604 );
605 $msg->set_requester_optional_messages($rom);
606  
607 This is a mandatory field.
608  
609 =cut
610 1 ▶sub set_requester_optional_messages {
Subroutine set_requester_optional_messages: called CC=3 SCAR=11.2
Pod documented
611 1 my $self = shift;
612 1 my ($parm) = shift;
613  
614 1 ▶ croak "missing requester-optional-messages" unless $parm;
Branch: 1 branch
BranchTrueFalseTotal
unless $parm 0 1 1
615 1 ▶ croak "invalid requester-optional-messages" unless (ref($parm) eq "Biblio::ILL::ISO::RequesterOptionalMessageType");
Branch: 1 branch
BranchTrueFalseTotal
unless ref $parm eq "Biblio::ILL::ISO::RequesterOptionalMessageType" 0 1 1
616  
617 1 $self->{"requester-optional-messages"} = $parm;
618  
619 1 return;
620 }
621  
622  
623 #---------------------------------------------------------------
624 #
625 #---------------------------------------------------------------
626 =head1
627  
628 =head2 set_search_type($st)
629  
630 Sets the message's search-type.
631 Expects a valid Biblio::ILL::ISO::SearchType.
632  
633 my $st = new Biblio::ILL::ISO::SearchType("need-Before-Date",
634 "1",
635 "20030720"
636 );
637 $msg->set_search_type($st);
638  
639 This is an optional field.
640  
641 =cut
642 1 ▶sub set_search_type {
Subroutine set_search_type: called CC=3 SCAR=11.2
Pod documented
643 1 my $self = shift;
644 1 my ($parm) = shift;
645  
646 1 ▶ croak "missing search-type" unless $parm;
Branch: 1 branch
BranchTrueFalseTotal
unless $parm 0 1 1
647 1 ▶ croak "invalid search-type" unless (ref($parm) eq "Biblio::ILL::ISO::SearchType");
Branch: 1 branch
BranchTrueFalseTotal
unless ref $parm eq "Biblio::ILL::ISO::SearchType" 0 1 1
648  
649 1 $self->{"search-type"} = $parm;
650  
651 1 return;
652 }
653  
654 #---------------------------------------------------------------
655 #
656 #---------------------------------------------------------------
657 =head1
658  
659 =head2 set_supply_medium_info_type_sequence($smits)
660  
661 Sets the message's supply-medium-info-type sequence.
662 Expects a valid Biblio::ILL::ISO::SupplyMediumInfoTypeSequence.
663  
664 my $smit = new Biblio::ILL::ISO::SupplyMediumInfoType("photocopy","legal-size paper");
665 # Just a sequence of one....
666 my $smits = new Biblio::ILL::ISO::SupplyMediumInfoTypeSequence( $smit );
667 $msg->set_supply_medium_info_type_sequence($smits);
668  
669 This is an optional field.
670  
671 =cut
672 1 ▶sub set_supply_medium_info_type_sequence {
Subroutine set_supply_medium_info_type_sequence: called CC=4 SCAR=14.3
Pod documented
673 1 my $self = shift;
674 1 my ($parm) = shift;
675  
676 1 ▶ croak "missing supply-medium-info-type sequence" unless $parm;
Branch: 1 branch
BranchTrueFalseTotal
unless $parm 0 1 1
677 1 ▶ croak "invalid supply-medium-info-type sequence" unless (ref($parm) eq "Biblio::ILL::ISO::SupplyMediumInfoTypeSequence");
Branch: 1 branch
BranchTrueFalseTotal
unless ref $parm eq "Biblio::ILL::ISO::SupplyMediumInfoTypeSequence" 0 1 1
678 1 ▶ croak "too many supply-medium-info-type in the sequence (max 7)" if ($parm->count() > 7);
Branch: 1 branch
BranchTrueFalseTotal
if $parm->count > 7 0 1 1
679  
680 1 $self->{"supply-medium-info-type sequence"} = $parm;
681  
682 1 return;
683 }
684  
685 #---------------------------------------------------------------
686 #
687 #---------------------------------------------------------------
688 =head1
689  
690 =head2 set_place_on_hold($poh)
691  
692 Sets the message's place-on-hold.
693 Expects a valid Biblio::ILL::ISO::PlaceOnHoldType.
694  
695 my $poh = new Biblio::ILL::ISO::PlaceOnHoldType("no");
696 $msg->set_place_on_hold($poh);
697  
698 This is a mandatory field.
699  
700 =cut
701 1 ▶sub set_place_on_hold {
Subroutine set_place_on_hold: called CC=3 SCAR=11.2
Pod documented
702 1 my $self = shift;
703 1 my ($parm) = shift;
704  
705 1 ▶ $parm = new Biblio::ILL::ISO::PlaceOnHoldType("according-to-responder-policy") unless ($parm);
Branch: 1 branch
BranchTrueFalseTotal
unless $parm 0 1 1
706 1 ▶ croak "invalid place-on-hold" unless (ref($parm) eq "Biblio::ILL::ISO::PlaceOnHoldType");
Branch: 1 branch
BranchTrueFalseTotal
unless ref $parm eq "Biblio::ILL::ISO::PlaceOnHoldType" 0 1 1
707  
708 1 $self->{"place-on-hold"} = $parm;
709  
710 1 return;
711 }
712  
713 #---------------------------------------------------------------
714 #
715 #---------------------------------------------------------------
716 =head1
717  
718 =head2 set_client_id($cid)
719  
720 Sets the message's client-id.
721 Expects a valid Biblio::ILL::ISO::ClientId.
722  
723 my $cid = new Biblio::ILL::ISO::ClientId("David Christensen",
724 "Most excellent",
725 "007"
726 );
727 $msg->set_client_id($cid)
728  
729 This is an optional field.
730  
731 =cut
732 1 ▶sub set_client_id {
Subroutine set_client_id: called CC=3 SCAR=11.2
Pod documented
733 1 my $self = shift;
734 1 my ($parm) = shift;
735  
736 1 ▶ croak "missing client-id" unless $parm;
Branch: 1 branch
BranchTrueFalseTotal
unless $parm 0 1 1
737 1 ▶ croak "invalid client-id" unless (ref($parm) eq "Biblio::ILL::ISO::ClientId");
Branch: 1 branch
BranchTrueFalseTotal
unless ref $parm eq "Biblio::ILL::ISO::ClientId" 0 1 1
738  
739 1 $self->{"client-id"} = $parm;
740  
741 1 return;
742 }
743  
744 #---------------------------------------------------------------
745 #
746 #---------------------------------------------------------------
747 =head1
748  
749 =head2 set_item_id($iid)
750  
751 Sets the message's item-id.
752 Expects a valid Biblio::ILL::ISO::ItemId.
753  
754 my $iid = new Biblio::ILL::ISO::ItemId("My Book",
755 "David Christensen",
756 "CHR001.1"
757 );
758 $iid->set_item_type("monograph");
759 $iid->set_medium_type("printed");
760 $iid->set_pagination("456");
761 $iid->set_publication_date("2003");
762 :
763 :
764  
765 $msg->set_item_id($iid);
766  
767 This is a mandatory field.
768  
769 =cut
770 1 ▶sub set_item_id {
Subroutine set_item_id: called CC=3 SCAR=11.2
Pod documented
771 1 my $self = shift;
772 1 my ($parm) = shift;
773  
774 1 ▶ croak "missing item-id" unless $parm;
Branch: 1 branch
BranchTrueFalseTotal
unless $parm 0 1 1
775 1 ▶ croak "invalid item-id" unless (ref($parm) eq "Biblio::ILL::ISO::ItemId");
Branch: 1 branch
BranchTrueFalseTotal
unless ref $parm eq "Biblio::ILL::ISO::ItemId" 0 1 1
776  
777 1 $self->{"item-id"} = $parm;
778  
779 1 return;
780 }
781  
782 #---------------------------------------------------------------
783 #
784 #---------------------------------------------------------------
785 =head1
786  
787 =head2 set_cost_info_type($cit)
788  
789 Sets the message's cost-info-type.
790 Expects a valid Biblio::ILL::ISO::CostInfoType.
791  
792 my $cit = new Biblio::ILL::ISO::CostInfoType("","","","PLS001","\$40.00");
793 $msg->set_cost_info_type($cit);
794  
795 This is an optional field.
796  
797 =cut
798 1 ▶sub set_cost_info_type {
Subroutine set_cost_info_type: called CC=3 SCAR=11.2
Pod documented
799 1 my $self = shift;
800 1 my ($parm) = shift;
801  
802 1 ▶ croak "missing cost-info-type" unless $parm;
Branch: 1 branch
BranchTrueFalseTotal
unless $parm 0 1 1
803 1 ▶ croak "invalid cost-info-type" unless (ref($parm) eq "Biblio::ILL::ISO::CostInfoType");
Branch: 1 branch
BranchTrueFalseTotal
unless ref $parm eq "Biblio::ILL::ISO::CostInfoType" 0 1 1
804  
805 1 $self->{"cost-info-type"} = $parm;
806  
807 1 return;
808 }
809  
810 #---------------------------------------------------------------
811 #
812 #---------------------------------------------------------------
813 =head1
814  
815 =head2 set_copyright_compliance($s)
816  
817 Sets the message's copyright-compliance.
818 Expects a simple text string.
819  
820 msg->set_copyright_compliance("Statement of copyright compliance");
821  
822 This is an optional field.
823  
824 =cut
825 1 ▶sub set_copyright_compliance {
Subroutine set_copyright_compliance: called CC=2 SCAR=7.0
Pod documented
826 1 my $self = shift;
827 1 my ($parm) = shift;
828  
829 1 ▶ croak "missing copyright-compliance" unless $parm;
Branch: 1 branch
BranchTrueFalseTotal
unless $parm 0 1 1
830  
831 1 $self->{"copyright-compliance"} = new Biblio::ILL::ISO::ILLString($parm);
832  
833 1 return;
834 }
835  
836 #---------------------------------------------------------------
837 #
838 #---------------------------------------------------------------
839 =head1
840  
841 =head2 set_third_party_info_type($tpit)
842  
843 Sets the message's third-party-info-type.
844 Expects a valid Biblio::ILL::ISO::ThirdPartyInfoType.
845  
846 # The send-to-list-type sequence
847 my $stlt = new Biblio::ILL::ISO::SendToListType( new Biblio::ILL::ISO::SystemId("MBOM") )
848 my $stlts = new Biblio::ILL::ISO::SendToListTypeSequence( $stlt );
849 $stlts->add(new Biblio::ILL::ISO::SendToListType( new Biblio::ILL::ISO::SystemId("MWPL"),
850 new Biblio::ILL::ISO::AccountNumber("PLS001"),
851 new Biblio::ILL::ISO::SystemAddress("SMTP","pls\@gov.mb.ca")
852 )
853 );
854  
855 # The already-tried-list-type
856 my $atlt = new Biblio::ILL::ISO::AlreadyTriedListType( new Biblio::ILL::ISO::SystemId("BVAS") );
857 my $obj = new Biblio::ILL::ISO::SystemId();
858 $obj->set_institution_name("Winnipeg Public Library");
859 $atlt->add($obj);
860 $obj = new Biblio::ILL::ISO::SystemId();
861 $obj->set_person_name("Frank Emil Urwald");
862 $atlt->add($obj);
863 $atlt->add( new Biblio::ILL::ISO::SystemId("MBOM"));
864  
865 # And finally, the third-party-info-type
866 my $sa = new Biblio::ILL::ISO::SystemAddress("SMTP","David_A_Christensen\@hotmail.com");
867 my $tpit = new Biblio::ILL::ISO::ThirdPartyInfoType(1,1,1,1,
868 "ordered",
869 $sa,
870 $stlts,
871 $atlt
872 );
873 msg->set_third_party_info_type($tpit);
874  
875 This is an optional field.
876  
877 =cut
878 1 ▶sub set_third_party_info_type {
Subroutine set_third_party_info_type: called CC=3 SCAR=11.2
Pod documented
879 1 my $self = shift;
880 1 my ($parm) = shift;
881  
882 1 ▶ croak "missing third-party-info-type" unless $parm;
Branch: 1 branch
BranchTrueFalseTotal
unless $parm 0 1 1
883 1 ▶ croak "invalid third-party-info-type" unless (ref($parm) eq "Biblio::ILL::ISO::ThirdPartyInfoType");
Branch: 1 branch
BranchTrueFalseTotal
unless ref $parm eq "Biblio::ILL::ISO::ThirdPartyInfoType" 0 1 1
884  
885 1 $self->{"third-party-info-type"} = $parm;
886  
887 1 return;
888 }
889  
890 #---------------------------------------------------------------
891 #
892 #---------------------------------------------------------------
893 =head1
894  
895 =head2 set_retry_flag($flag)
896  
897 Sets the message's retry-flag.
898 Acceptable parameter values are the strings:
899 true
900 false
901  
902 This is a mandatory field.
903  
904 =cut
905 1 ▶sub set_retry_flag {
Subroutine set_retry_flag: called CC=2 SCAR=7.0
Pod documented
906 1 my $self = shift;
907 1 my ($parm) = shift;
908  
909 1 ▶ $parm = "false" unless $parm;
Branch: 1 branch
BranchTrueFalseTotal
unless $parm 0 1 1
910 1 $self->{"retry-flag"} = new Biblio::ILL::ISO::Flag($parm);
911  
912 1 return;
913 }
914  
915 #---------------------------------------------------------------
916 #
917 #---------------------------------------------------------------
918 =head1
919  
920 =head2 set_forward_flag($flag)
921  
922 Sets the message's forward-flag.
923 Acceptable parameter values are the strings:
924 true
925 false
926  
927 This is a mandatory field.
928  
929 =cut
930 1 ▶sub set_forward_flag {
Subroutine set_forward_flag: called CC=2 SCAR=7.0
Pod documented
931 1 my $self = shift;
932 1 my ($parm) = shift;
933  
934 1 ▶ $parm = "false" unless $parm;
Branch: 1 branch
BranchTrueFalseTotal
unless $parm 0 1 1
935 1 $self->{"forward-flag"} = new Biblio::ILL::ISO::Flag($parm);
936  
937 1 return;
938 }
939  
940 #---------------------------------------------------------------
941 #
942 #---------------------------------------------------------------
943 =head1
944  
945 =head2 set_requester_note($note)
946  
947 Sets the message's requester-note.
948 Expects a simple text string.
949  
950 $msg->set_requester_note("This is a requester note");
951  
952 This is an optional field.
953  
954 =cut
955 1 ▶sub set_requester_note {
Subroutine set_requester_note: called CC=2 SCAR=7.0
Pod documented
956 1 my $self = shift;
957 1 my ($parm) = shift;
958  
959 1 ▶ croak "missing requester-note" unless $parm;
Branch: 1 branch
BranchTrueFalseTotal
unless $parm 0 1 1
960  
961 1 $self->{"requester-note"} = new Biblio::ILL::ISO::ILLString($parm);
962  
963 1 return;
964 }
965  
966 #---------------------------------------------------------------
967 #
968 #---------------------------------------------------------------
969 =head1
970  
971 =head2 set_forward_note($note)
972  
973 Sets the message's forward-note.
974 Expects a simple text string.
975  
976 $msg->set_forward_note("This is a forward note");
977  
978 This is an optional field.
979  
980 =cut
981 1 ▶sub set_forward_note {
Subroutine set_forward_note: called CC=2 SCAR=7.0
Pod documented
982 1 my $self = shift;
983 1 my ($parm) = shift;
984  
985 1 ▶ croak "missing forward-note" unless $parm;
Branch: 1 branch
BranchTrueFalseTotal
unless $parm 0 1 1
986  
987 1 $self->{"forward-note"} = new Biblio::ILL::ISO::ILLString($parm);
988  
989 1 return;
990 }
991  
992 =head1 RELATED MODULES
993  
994 Biblio::ILL::ISO::ISO
995 Biblio::ILL::ISO::Request
996 Biblio::ILL::ISO::ForwardNotification
997 Biblio::ILL::ISO::Shipped
998 Biblio::ILL::ISO::Answer
999 Biblio::ILL::ISO::ConditionalReply
1000 Biblio::ILL::ISO::Cancel
1001 Biblio::ILL::ISO::CancelReply
1002 Biblio::ILL::ISO::Received
1003 Biblio::ILL::ISO::Recall
1004 Biblio::ILL::ISO::Returned
1005 Biblio::ILL::ISO::CheckedIn
1006 Biblio::ILL::ISO::Overdue
1007 Biblio::ILL::ISO::Renew
1008 Biblio::ILL::ISO::RenewAnswer
1009 Biblio::ILL::ISO::Lost
1010 Biblio::ILL::ISO::Damaged
1011 Biblio::ILL::ISO::Message
1012 Biblio::ILL::ISO::StatusQuery
1013 Biblio::ILL::ISO::StatusOrErrorReport
1014 Biblio::ILL::ISO::Expired
1015  
1016 =cut
1017  
1018 =head1 SEE ALSO
1019  
1020 See the README for system design notes.
1021  
1022 For more information on Interlibrary Loan standards (ISO 10160/10161),
1023 a good place to start is:
1024  
1025 http://www.nlc-bnc.ca/iso/ill/main.htm
1026  
1027 =cut
1028  
1029 =head1 AUTHOR
1030  
1031 David Christensen, <DChristensenSPAMLESS@westman.wave.ca>
1032  
1033 =cut
1034  
1035  
1036 =head1 COPYRIGHT AND LICENSE
1037  
1038 Copyright 2003 by David Christensen
1039  
1040 This library is free software; you can redistribute it and/or modify it
1041 under the same terms as Perl itself.
1042  
1043 =cut
1044  
1045 2 1;
« lib/Biblio/ILL/ISO/HistoryReport.pm ↑ Summary lib/Biblio/ILL/ISO/ItemId.pm »