lib/Biblio/ILL/ISO/UnfilledResults.pm

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