lib/Biblio/ILL/ISO/DeliveryService.pm

filter: Statementstmt 54.7% 23 / 42 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 48.6% 35 / 72 CC 10 SCAR 22.1
CC
10
Cov
44%
from_asn
20.0
set
12.0
new
6.9
CRAP 9.1
« lib/Biblio/ILL/ISO/EDeliveryDetails.pm ↑ Summary lib/Biblio/ILL/ISO/SupplyMediumInfoType.pm »
1 package Biblio::ILL::ISO::DeliveryService;
2  
3 =head1 NAME
4  
5 Biblio::ILL::ISO::DeliveryService
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::TransportationMode;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 4 ▶use Biblio::ILL::ISO::ElectronicDeliveryServiceSequence;
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.02';
22 #---------------------------------------------------------------------------
23 # Mods
24 # 0.02 - 2003.09.07 - fixed the POD
25 # 0.01 - 2003.07.15 - original version
26 #---------------------------------------------------------------------------
27  
28 =head1 DESCRIPTION
29  
30 Biblio::ILL::ISO::DeliveryService is a derivation of Biblio::ILL::ISO::ILLASNtype.
31  
32 =head1 USES
33  
34 Biblio::ILL::ISO::TransportationMode
35 Biblio::ILL::ISO::ElectronicDeliveryServiceSequence
36  
37 =head1 USED IN
38  
39 Biblio::ILL::ISO::ConditionalResults
40  
41 =cut
42  
43 4 ▶BEGIN{@ISA = qw ( Biblio::ILL::ISO::ILLASNtype );} # inherit from ILLASNtype
Subroutine BEGIN: called CC=1 SCAR=0.0
44  
45 =head1 FROM THE ASN DEFINITION
46
47 Delivery-Service ::= CHOICE {
48 physical-delivery [7] Transportation-Mode,
49 electronic-delivery [50] IMPLICIT SEQUENCE OF Electronic-Delivery-Service
50 -- electronic-delivery may only be present in APDUs
51 -- with a protocol-version-num value of 2 or greater
52 }
53  
54 =cut
55  
56 =head1 METHODS
57  
58 =cut
59  
60 #---------------------------------------------------------------
61 #
62 #---------------------------------------------------------------
63 =head1
64  
65 =head2 new( [$transportation_mode | $e_delivery_service_seq] )
66  
67 Creates a new DeliveryService object.
68 Expects either no paramaters, or one of:
69 physical-delivery (Biblio::ILL::ISO::TransportationMode), or
70 electronic-delivery (Biblio::ILL::ISO::ElectronicDeliveryServiceSequence).
71  
72 =cut
73 4 ▶sub new {
Subroutine new: called CC=5 SCAR=19.3
Pod documented
74 4 my $class = shift;
75 4 my $self = {};
76  
77 4 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 4 0 4
78 4 my ($objref) = @_;
79
80 4 ▶ if (ref($objref) eq "Biblio::ILL::ISO::TransportationMode") {
Branch: 2 branches
BranchTrueFalseTotal
if (ref $objref eq 'Biblio::ILL::ISO::TransportationMode') { } 4 0 4
elsif (ref $objref eq 'Biblio::ILL::ISO::ElectronicDeliveryServiceSequence') { } 0 0 0
81 4 $self->{"physical-delivery"} = $objref;
82 } elsif (ref($objref) eq "Biblio::ILL::ISO::ElectronicDeliveryServiceSequence") {
83 0 $self->{"electronic-delivery"} = $objref;
84 } else {
85 0 croak "Invalid ElectronicDeliveryServiceSequence";
86 }
87 }
88  
89 4 ▶ bless($self, ref($class) || $class);
Condition33%1/3
ref $class || $class
l!l&&r!l&&!r
040
MC/DC0%0/2
ref $class || $class
ref $class $class
Truth table33%1/3
A || B
A= ref $classB= $class
ABresult
1X1
011
000
90 4 return ($self);
91 }
92  
93  
94 #---------------------------------------------------------------
95 #
96 #---------------------------------------------------------------
97 =head1
98  
99 =head2 set( [$transportation_mode | $e_delivery_service_seq] )
100  
101 Sets the object's physical-delivery or electronic-delivery.
102 Expects one of:
103 physical-delivery (Biblio::ILL::ISO::TransportationMode), or
104 electronic-delivery (Biblio::ILL::ISO::ElectronicDeliveryServiceSequence).
105  
106 =cut
107 0 ▶sub set {
Subroutine set: not called CC=3 SCAR=24.8
Pod documented
108 0 my $self = shift;
109 0 my ($objref) = @_;
110
111 0 ▶ if (ref($objref) eq "Biblio::ILL::ISO::TransportationMode") {
Branch: 2 branches
BranchTrueFalseTotal
if (ref $objref eq 'Biblio::ILL::ISO::TransportationMode') { } 0 0 0
elsif (ref $objref eq 'Biblio::ILL::ISO::ElectronicDeliveryServiceSequence') { } 0 0 0
112 0 $self->{"physical-delivery"} = $objref;
113 } elsif (ref($objref) eq "Biblio::ILL::ISO::ElectronicDeliveryServiceSequence") {
114 0 $self->{"electronic-delivery"} = $objref;
115 } else {
116 0 croak "Invalid ElectronicDeliveryServiceSequence";
117 }
118
119 0 return;
120 }
121  
122 #---------------------------------------------------------------
123 #
124 #---------------------------------------------------------------
125 =head1
126  
127 =head2 from_asn($href)
128  
129 Given a properly formatted hash, builds the object.
130  
131 =cut
132 0 ▶sub from_asn {
Subroutine from_asn: not called CC=4 SCAR=30.0
Pod documented
133 0 my $self = shift;
134 0 my $href = shift;
135  
136 0 foreach my $k (keys %$href) {
137 #print ref($self) . "...$k\n";
138  
139 0 ▶ if ($k =~ /^physical-delivery$/) {
Branch: 2 branches
BranchTrueFalseTotal
if ($k =~ /^physical-delivery$/) { } 0 0 0
elsif ($k =~ /^electronic-delivery$/) { } 0 0 0
140 0 $self->{$k} = new Biblio::ILL::ISO::TransportationMode();
141 0 $self->{$k}->from_asn($href->{$k});
142  
143 } elsif ($k =~ /^electronic-delivery$/) {
144 0 $self->{$k} = new Biblio::ILL::ISO::ElectronicDeliveryServiceSequence();
145 0 $self->{$k}->from_asn($href->{$k});
146  
147 } else {
148 0 croak "invalid " . ref($self) . " element: [$k]";
149 }
150  
151 }
152 0 return $self;
153 }
154  
155 =head1 SEE ALSO
156  
157 See the README for system design notes.
158 See the parent class(es) for other available methods.
159  
160 For more information on Interlibrary Loan standards (ISO 10160/10161),
161 a good place to start is:
162  
163 http://www.nlc-bnc.ca/iso/ill/main.htm
164  
165 =cut
166  
167 =head1 AUTHOR
168  
169 David Christensen, <DChristensenSPAMLESS@westman.wave.ca>
170  
171 =cut
172  
173  
174 =head1 COPYRIGHT AND LICENSE
175  
176 Copyright 2003 by David Christensen
177  
178 This library is free software; you can redistribute it and/or modify it
179 under the same terms as Perl itself.
180  
181 =cut
182  
183 4 1;
« lib/Biblio/ILL/ISO/EDeliveryDetails.pm ↑ Summary lib/Biblio/ILL/ISO/SupplyMediumInfoType.pm »