lib/Biblio/ILL/ISO/ShippedVia.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 66.6% 2 / 3 totaltotal 47.2% 34 / 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/ElectronicDeliveryService.pm ↑ Summary lib/Biblio/ILL/ISO/EDeliveryDetails.pm »
1 package Biblio::ILL::ISO::ShippedVia;
2  
3 =head1 NAME
4  
5 Biblio::ILL::ISO::ShippedVia
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::ElectronicDeliveryService;
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.08.11 - original version
25 #---------------------------------------------------------------------------
26  
27 =head1 DESCRIPTION
28  
29 Biblio::ILL::ISO::ShippedVia is a derivation of Biblio::ILL::ISO::ILLASNtype.
30  
31 =head1 USES
32  
33 Biblio::ILL::ISO::TransportationMode
34 Biblio::ILL::ISO::ElectronicDeliveryService
35  
36 =head1 USED IN
37  
38 Biblio::ILL::ISO::SupplyDetails
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 Shipped-Via ::= CHOICE {
47 physical-delivery [5] Transportation-Mode,
48 electronic-delivery [50] IMPLICIT Electronic-Delivery-Service
49 }
50  
51 =cut
52  
53 =head1 METHODS
54  
55 =cut
56  
57 #---------------------------------------------------------------
58 #
59 #---------------------------------------------------------------
60 =head1
61  
62 =head2 new( $transportation_mode | $electronic_delivery_service )
63  
64 Creates a new ShippedVia object.
65 Expects either a transportation mode (Biblio::ILL::ISO::TransportationMode), or
66 an electronic delivery service (Biblio::ILL::ISO::ElectronicDeliveryService).
67  
68 =cut
69 2 ▶sub new {
Subroutine new: called CC=5 SCAR=19.3
Pod documented
70 2 my $class = shift;
71 2 my $self = {};
72  
73 2 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 2 0 2
74 2 my ($objref) = @_;
75
76 2 ▶ if (ref($objref) eq "Biblio::ILL::ISO::TransportationMode") {
Branch: 2 branches
BranchTrueFalseTotal
if (ref $objref eq 'Biblio::ILL::ISO::TransportationMode') { } 2 0 2
elsif (ref $objref eq 'Biblio::ILL::ISO::ElectronicDeliveryService') { } 0 0 0
77 2 $self->{"physical-delivery"} = $objref;
78 } elsif (ref($objref) eq "Biblio::ILL::ISO::ElectronicDeliveryService") {
79 0 $self->{"electronic-delivery"} = $objref;
80 } else {
81 0 croak "Invalid ElectronicDeliveryService";
82 }
83 }
84  
85 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
86 2 return ($self);
87 }
88  
89  
90 #---------------------------------------------------------------
91 #
92 #---------------------------------------------------------------
93 =head1
94  
95 =head2 new( $transportation_mode | $electronic_delivery_service )
96  
97 Sets the object's physical-delivery (transportation mode) (Biblio::ILL::ISO::TransportationMode), or
98 electronic-delivery (Biblio::ILL::ISO::ElectronicDeliveryService).
99  
100 =cut
101 0 ▶sub set {
Subroutine set: not called CC=3 SCAR=24.8
Pod undocumented
102 0 my $self = shift;
103 0 my ($objref) = @_;
104
105 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::ElectronicDeliveryService') { } 0 0 0
106 0 $self->{"physical-delivery"} = $objref;
107 } elsif (ref($objref) eq "Biblio::ILL::ISO::ElectronicDeliveryService") {
108 0 $self->{"electronic-delivery"} = $objref;
109 } else {
110 0 croak "Invalid ElectronicDeliveryService";
111 }
112
113 0 return;
114 }
115  
116 #---------------------------------------------------------------
117 #
118 #---------------------------------------------------------------
119 =head1
120  
121 =head2 from_asn($href)
122  
123 Given a properly formatted hash, builds the object.
124  
125 =cut
126 0 ▶sub from_asn {
Subroutine from_asn: not called CC=4 SCAR=30.0
Pod documented
127 0 my $self = shift;
128 0 my $href = shift;
129  
130 0 foreach my $k (keys %$href) {
131 #print ref($self) . "...$k\n";
132  
133 0 ▶ if ($k =~ /^physical-delivery$/) {
Branch: 2 branches
BranchTrueFalseTotal
if ($k =~ /^physical-delivery$/) { } 0 0 0
elsif ($k =~ /^electronic-delivery$/) { } 0 0 0
134 0 $self->{$k} = new Biblio::ILL::ISO::TransportationMode();
135 0 $self->{$k}->from_asn($href->{$k});
136  
137 } elsif ($k =~ /^electronic-delivery$/) {
138 0 $self->{$k} = new Biblio::ILL::ISO::ElectronicDeliveryService();
139 0 $self->{$k}->from_asn($href->{$k});
140  
141 } else {
142 0 croak "invalid " . ref($self) . " element: [$k]";
143 }
144  
145 }
146 0 return $self;
147 }
148  
149 =head1 SEE ALSO
150  
151 See the README for system design notes.
152 See the parent class(es) for other available methods.
153  
154 For more information on Interlibrary Loan standards (ISO 10160/10161),
155 a good place to start is:
156  
157 http://www.nlc-bnc.ca/iso/ill/main.htm
158  
159 =cut
160  
161 =head1 AUTHOR
162  
163 David Christensen, <DChristensenSPAMLESS@westman.wave.ca>
164  
165 =cut
166  
167  
168 =head1 COPYRIGHT AND LICENSE
169  
170 Copyright 2003 by David Christensen
171  
172 This library is free software; you can redistribute it and/or modify it
173 under the same terms as Perl itself.
174  
175 =cut
176  
177 4 1;
« lib/Biblio/ILL/ISO/ElectronicDeliveryService.pm ↑ Summary lib/Biblio/ILL/ISO/EDeliveryDetails.pm »