lib/Biblio/ILL/ISO/HoldPlacedResults.pm

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