lib/Biblio/ILL/ISO/LocationsResults.pm

filter: Statementstmt 58.7% 27 / 46 Branchbran 23.0% 6 / 26 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 75.0% 6 / 8 Podpod 100% 3 / 3 totaltotal 48.8% 43 / 88 CC 16 SCAR 28.9
CC
16
Cov
45%
set
42.0
from_asn
20.0
new
9.7
CRAP 18.0
« lib/Biblio/ILL/ISO/ServiceDateTime.pm ↑ Summary lib/Biblio/ILL/ISO/SendToListType.pm »
1 package Biblio::ILL::ISO::LocationsResults;
2  
3 =head1 NAME
4  
5 Biblio::ILL::ISO::LocationsResults
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::ReasonLocsProvided;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 4 ▶use Biblio::ILL::ISO::LocationInfoSequence;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 4 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 =head1 VERSION
15  
16 Version 0.01
17  
18 =cut
19  
20 4 our $VERSION = '0.01';
21 #---------------------------------------------------------------------------
22 # Mods
23 # 0.01 - 2003.07.26 - original version
24 #---------------------------------------------------------------------------
25  
26 =head1 DESCRIPTION
27  
28 Biblio::ILL::ISO::LocationResults is a derivation of Biblio::ILL::ISO::ILLASNtype.
29  
30 =head1 USES
31  
32 Biblio::ILL::ISO::ReasonLocsProvided
33 Biblio::ILL::ISO::LocationInfoSequence
34  
35 =head1 USED IN
36  
37 Biblio::ILL::ISO::ResultsExplanation
38  
39 =cut
40  
41 4 ▶BEGIN{@ISA = qw ( Biblio::ILL::ISO::ILLASNtype );} # inherit from ILLASNtype
Subroutine BEGIN: called CC=1 SCAR=0.0
42  
43 =head1 FROM THE ASN DEFINITION
44
45 Locations-Results ::= EXPLICIT SEQUENCE {
46 reason-locs-provided [0] IMPLICIT Reason-Locs-Provided OPTIONAL,
47 locations [1] IMPLICIT SEQUENCE OF Location-Info
48 }
49  
50 =cut
51  
52 =head1 METHODS
53  
54 =cut
55 #---------------------------------------------------------------
56 #
57 #---------------------------------------------------------------
58 =head1
59  
60 =head2 new( $reason [,$locations] )
61  
62 Creates a new LocationsResults object.
63 Expects a reason-locs-provided (Biblio::ILL::ISO::ReasonLocsProvided), and
64 (optionally) a location sequence (Biblio::ILL::ISO::LocationInfoSequence).
65  
66 =cut
67 1 ▶sub new {
Subroutine new: called CC=8 SCAR=22.7
Pod documented
68 1 my $class = shift;
69 1 my $self = {};
70  
71 1 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 1 0 1
72 1 my ($reason, $locations) = @_;
73  
74 1 ▶ croak "missing locations-results reason-locs-provided" unless ($reason);
Branch: 1 branch
BranchTrueFalseTotal
unless $reason 0 1 1
75 1 ▶ croak "invalid locations-results reason-locs-provided" unless (ref($reason) eq "Biblio::ILL::ISO::ReasonLocsProvided");
Branch: 1 branch
BranchTrueFalseTotal
unless ref $reason eq "Biblio::ILL::ISO::ReasonLocsProvided" 0 1 1
76  
77 1 ▶ if ($locations) {
Branch: 1 branch
BranchTrueFalseTotal
if ($locations) 1 0 1
78 1 ▶ croak "invalid locations" unless (ref($locations) eq "Biblio::ILL::ISO::LocationInfoSequence");
Branch: 1 branch
BranchTrueFalseTotal
unless ref $locations eq "Biblio::ILL::ISO::LocationInfoSequence" 0 1 1
79 }
80
81 1 $self->{"reason-locs-provided"} = $reason;
82 1 ▶ $self->{"locations"} = $locations if ($locations);;
Branch: 1 branch
BranchTrueFalseTotal
if $locations 1 0 1
83 }
84  
85 1 ▶ bless($self, ref($class) || $class);
Condition33%1/3
ref $class || $class
l!l&&r!l&&!r
010
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 1 return ($self);
87 }
88  
89  
90 #---------------------------------------------------------------
91 #
92 #---------------------------------------------------------------
93 =head1
94  
95 =head2 set( $reason [,$locations] )
96  
97 Sets the object's
98 reason-locs-provided (Biblio::ILL::ISO::ReasonLocsProvided), and
99 (optionally) locations (Biblio::ILL::ISO::LocationInfoSequence).
100  
101 =cut
102 0 ▶sub set {
Subroutine set: not called CC=6 SCAR=37.4
Pod documented
103 0 my $self = shift;
104  
105 0 my ($reason, $locations) = @_;
106
107 0 ▶ croak "missing locations-results reason-locs-provided" unless ($reason);
Branch: 1 branch
BranchTrueFalseTotal
unless $reason 0 0 0
108 0 ▶ croak "invalid locations-results reason-locs-provided" unless (ref($reason) eq "Biblio::ILL::ISO::ReasonLocsProvided");
Branch: 1 branch
BranchTrueFalseTotal
unless ref $reason eq "Biblio::ILL::ISO::ReasonLocsProvided" 0 0 0
109
110 0 ▶ if ($locations) {
Branch: 1 branch
BranchTrueFalseTotal
if ($locations) 0 0 0
111 0 ▶ croak "invalid locations" unless (ref($locations) eq "Biblio::ILL::ISO::LocationInfoSequence");
Branch: 1 branch
BranchTrueFalseTotal
unless ref $locations eq "Biblio::ILL::ISO::LocationInfoSequence" 0 0 0
112 }
113
114 0 $self->{"reason-locs-provided"} = $reason;
115 0 ▶ $self->{"locations"} = $locations if ($locations);;
Branch: 1 branch
BranchTrueFalseTotal
if $locations 0 0 0
116
117 0 return;
118 }
119  
120 #---------------------------------------------------------------
121 #
122 #---------------------------------------------------------------
123 =head1
124  
125 =head2 from_asn($href)
126  
127 Given a properly formatted hash, builds the object.
128  
129 =cut
130 0 ▶sub from_asn {
Subroutine from_asn: not called CC=4 SCAR=30.0
Pod documented
131 0 my $self = shift;
132 0 my $href = shift;
133  
134 0 foreach my $k (keys %$href) {
135 #print ref($self) . "...$k\n";
136  
137 0 ▶ if ($k =~ /^reason-locs-provided$/) {
Branch: 2 branches
BranchTrueFalseTotal
if ($k =~ /^reason-locs-provided$/) { } 0 0 0
elsif ($k =~ /^locations$/) { } 0 0 0
138 0 $self->{$k} = new Biblio::ILL::ISO::ReasonLocsProvided();
139 0 $self->{$k}->from_asn($href->{$k});
140
141 } elsif ($k =~ /^locations$/) {
142 0 $self->{$k} = new Biblio::ILL::ISO::LocationInfoSequence();
143 0 $self->{$k}->from_asn($href->{$k});
144  
145 } else {
146 0 croak "invalid " . ref($self) . " element: [$k]";
147 }
148  
149 }
150 0 return $self;
151 }
152  
153 =head1 SEE ALSO
154  
155 See the README for system design notes.
156 See the parent class(es) for other available methods.
157  
158 For more information on Interlibrary Loan standards (ISO 10160/10161),
159 a good place to start is:
160  
161 http://www.nlc-bnc.ca/iso/ill/main.htm
162  
163 =cut
164  
165 =head1 AUTHOR
166  
167 David Christensen, <DChristensenSPAMLESS@westman.wave.ca>
168  
169 =cut
170  
171  
172 =head1 COPYRIGHT AND LICENSE
173  
174 Copyright 2003 by David Christensen
175  
176 This library is free software; you can redistribute it and/or modify it
177 under the same terms as Perl itself.
178  
179 =cut
180  
181 4 1;
« lib/Biblio/ILL/ISO/ServiceDateTime.pm ↑ Summary lib/Biblio/ILL/ISO/SendToListType.pm »