lib/Biblio/ILL/ISO/EDeliveryDetails.pm

filter: Statementstmt 53.4% 23 / 43 Branchbran 14.2% 2 / 14 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 75.0% 6 / 8 Podpod 100% 3 / 3 totaltotal 47.9% 35 / 73 CC 10 SCAR 22.1
CC
10
Cov
43%
from_asn
20.0
set
12.0
new
6.9
CRAP 9.1
« lib/Biblio/ILL/ISO/ShippedVia.pm ↑ Summary lib/Biblio/ILL/ISO/DeliveryService.pm »
1 package Biblio::ILL::ISO::EDeliveryDetails;
2  
3 =head1 NAME
4  
5 Biblio::ILL::ISO::EDeliveryDetails
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::SystemAddress;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 4 ▶use Biblio::ILL::ISO::SystemId;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 4 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 =head1 VERSION
16  
17 Version 0.01
18  
19 =cut
20  
21 4 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 ▶BEGIN{@ISA = qw ( Biblio::ILL::ISO::ILLASNtype );} # inherit from ILLASNtype
Subroutine BEGIN: called CC=1 SCAR=0.0
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 2 ▶sub new {
Subroutine new: called CC=5 SCAR=19.3
Pod documented
72 2 my $class = shift;
73 2 my $self = {};
74  
75 2 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 2 0 2
76 2 my ($objref) = @_;
77  
78 2 ▶ if (ref($objref) eq "Biblio::ILL::ISO::SystemAddress") {
Branch: 2 branches
BranchTrueFalseTotal
if (ref $objref eq 'Biblio::ILL::ISO::SystemAddress') { } 2 0 2
elsif (ref $objref eq 'Biblio::ILL::ISO::SystemId') { } 0 0 0
79 2 $self->{"e-delivery-address"} = $objref;
80 } elsif (ref($objref) eq "Biblio::ILL::ISO::SystemId") {
81 0 $self->{"e-delivery-id"} = $objref;
82 } else {
83 0 croak "Invalid e-delivery-details";
84 }
85 }
86  
87 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
88 2 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 0 ▶sub set {
Subroutine set: not called CC=3 SCAR=24.8
Pod documented
104 0 my $self = shift;
105 0 my ($objref) = @_;
106
107 0 ▶ if (ref($objref) eq "Biblio::ILL::ISO::SystemAddress") {
Branch: 2 branches
BranchTrueFalseTotal
if (ref $objref eq 'Biblio::ILL::ISO::SystemAddress') { } 0 0 0
elsif (ref $objref eq 'Biblio::ILL::ISO::SystemId') { } 0 0 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 0 ▶sub from_asn {
Subroutine from_asn: not called CC=4 SCAR=30.0
Pod documented
129 0 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 ▶ if ($k =~ /^e-delivery-address$/) {
Branch: 2 branches
BranchTrueFalseTotal
if ($k =~ /^e-delivery-address$/) { } 0 0 0
elsif ($k =~ /^e-delivery-id$/) { } 0 0 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, <DChristensenSPAMLESS@westman.wave.ca>
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 4 1;
« lib/Biblio/ILL/ISO/ShippedVia.pm ↑ Summary lib/Biblio/ILL/ISO/DeliveryService.pm »