File Coverage

blib/lib/Biblio/ILL/ISO/ElectronicDeliveryService.pm
Criterion Covered Total %
statement 36 56 64.2
branch 2 12 16.6
condition 1 6 16.6
subroutine 10 12 83.3
pod 6 6 100.0
total 55 92 59.7


line stmt bran cond sub pod time code
1             package Biblio::ILL::ISO::ElectronicDeliveryService;
2              
3             =head1 NAME
4              
5             Biblio::ILL::ISO::ElectronicDeliveryService
6              
7             =cut
8              
9 4     4   23 use Biblio::ILL::ISO::ILLASNtype;
  4         8  
  4         97  
10 4     4   2341 use Biblio::ILL::ISO::EDeliveryDetails;
  4         10  
  4         128  
11 4     4   26 use Biblio::ILL::ISO::ILLString;
  4         10  
  4         85  
12 4     4   24 use Biblio::ILL::ISO::ISOTime;
  4         8  
  4         87  
13              
14 4     4   19 use Carp;
  4         20  
  4         429  
15              
16             =head1 VERSION
17              
18             Version 0.01
19              
20             =cut
21              
22             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     4   3378 BEGIN{@ISA = qw ( Biblio::ILL::ISO::ILLASNtype );} # inherit from ILLASNtype
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             sub new {
95 2     2 1 12 my $class = shift;
96 2         9 my $self = {};
97              
98 2 50       5 if (@_) {
99             # if there's anything, it's the one mandatory field....
100 2         3 my $objref = shift;
101            
102 2 50       5 if (ref($objref) eq "Biblio::ILL::ISO::EDeliveryDetails") {
103 2         5 $self->{"e-delivery-details"} = $objref;
104             } else {
105 0         0 croak "Invalid e-delivery-details";
106             }
107             }
108              
109 2   33     15 bless($self, ref($class) || $class);
110 2         6 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             sub from_asn {
125 0     0 1 0 my $self = shift;
126 0         0 my $href = shift;
127              
128 0         0 foreach my $k (keys %$href) {
129 0         0 print ref($self) . "...$k\n";
130              
131 0 0 0     0 if (($k =~ /^e-delivery-description$/)
    0          
    0          
132             || ($k =~ /^name-or-code$/)
133             ) {
134 0         0 $self->{$k} = new Biblio::ILL::ISO::ILLString();
135 0         0 $self->{$k}->from_asn($href->{$k});
136              
137             } elsif ($k =~ /^e-delivery-details$/) {
138 0         0 $self->{$k} = new Biblio::ILL::ISO::EDeliveryDetails();
139 0         0 $self->{$k}->from_asn($href->{$k});
140              
141             } elsif ($k =~ /^delivery-time$/) {
142 0         0 $self->{$k} = new Biblio::ILL::ISO::ISOTime();
143 0         0 $self->{$k}->from_asn($href->{$k});
144              
145             } else {
146 0         0 croak "invalid " . ref($self) . " element: [$k]";
147             }
148              
149             }
150 0         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             sub set_description {
165 2     2 1 8 my $self = shift;
166 2         4 my ($s) = @_;
167              
168 2         7 $self->{"e-delivery-description"} = new Biblio::ILL::ISO::ILLString($s);
169 2         4 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             sub set_details {
184 0     0 1 0 my $self = shift;
185 0         0 my $objref = shift;
186            
187 0 0       0 if (ref($objref) eq "Biblio::ILL::ISO::EDeliveryDetails") {
188 0         0 $self->{"e-delivery-details"} = $objref;
189             } else {
190 0         0 croak "Invalid e-delivery-details";
191             }
192              
193 0         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             sub set_name_or_code {
209 2     2 1 8 my $self = shift;
210 2         4 my ($s) = @_;
211              
212 2         5 $self->{"name-or-code"} = new Biblio::ILL::ISO::ILLString($s);
213 2         3 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             sub set_delivery_time {
228 2     2 1 8 my $self = shift;
229 2         3 my ($s) = @_;
230              
231 2         13 $self->{"delivery-time"} = new Biblio::ILL::ISO::ISOTime($s);
232 2         4 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,
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             1;