File Coverage

blib/lib/Biblio/ILL/ISO/EDeliveryDetails.pm
Criterion Covered Total %
statement 21 41 51.2
branch 2 14 14.2
condition 1 3 33.3
subroutine 6 8 75.0
pod 3 3 100.0
total 33 69 47.8


line stmt bran cond sub pod time code
1             package Biblio::ILL::ISO::EDeliveryDetails;
2              
3             =head1 NAME
4              
5             Biblio::ILL::ISO::EDeliveryDetails
6              
7             =cut
8              
9 4     4   24 use Biblio::ILL::ISO::ILLASNtype;
  4         7  
  4         101  
10 4     4   23 use Biblio::ILL::ISO::SystemAddress;
  4         6  
  4         88  
11 4     4   22 use Biblio::ILL::ISO::SystemId;
  4         19  
  4         86  
12              
13 4     4   20 use Carp;
  4         15  
  4         400  
14              
15             =head1 VERSION
16              
17             Version 0.01
18              
19             =cut
20              
21             our $VERSION = '0.01';
22             #---------------------------------------------------------------------------
23             # Mods
24             # 0.01 - 2003.07.15 - original version
25             #---------------------------------------------------------------------------
26              
27             =head1 DESCRIPTION
28              
29             Biblio::ILL::ISO::EDeliveryDetails is a derivation of Biblio::ILL::ISO::ILLASNtype.
30              
31             =head1 USES
32              
33             Biblio::ILL::ISO::SystemAddress
34             Biblio::ILL::ISO::SystemId
35              
36             =head1 USED IN
37              
38             Biblio::ILL::ISO::ElectronicDeliveryService
39              
40             =cut
41              
42 4     4   1897 BEGIN{@ISA = qw ( Biblio::ILL::ISO::ILLASNtype );} # inherit from ILLASNtype
43              
44             =head1 FROM THE ASN DEFINITION
45              
46             (part of Electronic-Delivery-Service)
47              
48             e-delivery-details [5] CHOICE {
49             e-delivery-address [0] IMPLICIT System-Address,
50             e-delivery-id [1] IMPLICIT System-Id
51             }
52              
53             =cut
54              
55             =head1 METHODS
56              
57             =cut
58             #---------------------------------------------------------------
59             #
60             #---------------------------------------------------------------
61             =head1
62              
63             =head2 new( [$system_address | $system_id] )
64              
65             Creates a new EDeliveryDetails object.
66             Expects either no parameters, or one of
67             e-delivery-address (Biblio::ILL::ISO::SystemAddress), or
68             e-delivery-id (Biblio::ILL::ISO::SystemId).
69              
70             =cut
71             sub new {
72 2     2 1 3 my $class = shift;
73 2         4 my $self = {};
74              
75 2 50       6 if (@_) {
76 2         2 my ($objref) = @_;
77              
78 2 50       7 if (ref($objref) eq "Biblio::ILL::ISO::SystemAddress") {
    0          
79 2         5 $self->{"e-delivery-address"} = $objref;
80             } elsif (ref($objref) eq "Biblio::ILL::ISO::SystemId") {
81 0         0 $self->{"e-delivery-id"} = $objref;
82             } else {
83 0         0 croak "Invalid e-delivery-details";
84             }
85             }
86              
87 2   33     11 bless($self, ref($class) || $class);
88 2         6 return ($self);
89             }
90              
91              
92             #---------------------------------------------------------------
93             #
94             #---------------------------------------------------------------
95             =head1
96              
97             =head2 set( $system_address | $system_id )
98              
99             Sets the object's e-delivery-address (Biblio::ILL::ISO::SystemAddress), or
100             e-delivery-id (Biblio::ILL::ISO::SystemId).
101              
102             =cut
103             sub set {
104 0     0 1   my $self = shift;
105 0           my ($objref) = @_;
106            
107 0 0         if (ref($objref) eq "Biblio::ILL::ISO::SystemAddress") {
    0          
108 0           $self->{"e-delivery-address"} = $objref;
109             } elsif (ref($objref) eq "Biblio::ILL::ISO::SystemId") {
110 0           $self->{"e-delivery-id"} = $objref;
111             } else {
112 0           croak "Invalid e-delivery-details";
113             }
114            
115 0           return;
116             }
117              
118             #---------------------------------------------------------------
119             #
120             #---------------------------------------------------------------
121             =head1
122              
123             =head2 from_asn($href)
124              
125             Given a properly formatted hash, builds the object.
126              
127             =cut
128             sub from_asn {
129 0     0 1   my $self = shift;
130 0           my $href = shift;
131              
132 0           foreach my $k (keys %$href) {
133 0           print ref($self) . "...$k\n";
134              
135 0 0         if ($k =~ /^e-delivery-address$/) {
    0          
136 0           $self->{$k} = new Biblio::ILL::ISO::SystemAddress();
137 0           $self->{$k}->from_asn($href->{$k});
138              
139             } elsif ($k =~ /^e-delivery-id$/) {
140 0           $self->{$k} = new Biblio::ILL::ISO::SystemId();
141 0           $self->{$k}->from_asn($href->{$k});
142              
143             } else {
144 0           croak "invalid " . ref($self) . " element: [$k]";
145             }
146              
147             }
148 0           return $self;
149             }
150              
151             =head1 SEE ALSO
152              
153             See the README for system design notes.
154             See the parent class(es) for other available methods.
155              
156             For more information on Interlibrary Loan standards (ISO 10160/10161),
157             a good place to start is:
158              
159             http://www.nlc-bnc.ca/iso/ill/main.htm
160              
161             =cut
162              
163             =head1 AUTHOR
164              
165             David Christensen,
166              
167             =cut
168              
169              
170             =head1 COPYRIGHT AND LICENSE
171              
172             Copyright 2003 by David Christensen
173              
174             This library is free software; you can redistribute it and/or modify it
175             under the same terms as Perl itself.
176              
177             =cut
178              
179             1;