File Coverage

blib/lib/Biblio/ILL/ISO/ResultsExplanation.pm
Criterion Covered Total %
statement 36 73 49.3
branch 2 44 4.5
condition 1 3 33.3
subroutine 11 13 84.6
pod 3 3 100.0
total 53 136 38.9


line stmt bran cond sub pod time code
1             package Biblio::ILL::ISO::ResultsExplanation;
2              
3             =head1 NAME
4              
5             Biblio::ILL::ISO::ResultsExplanation
6              
7             =cut
8              
9 4     4   741 use Biblio::ILL::ISO::ILLASNtype;
  4         186  
  4         93  
10 4     4   53 use Biblio::ILL::ISO::ConditionalResults;
  4         10  
  4         103  
11 4     4   2351 use Biblio::ILL::ISO::RetryResults;
  4         10  
  4         109  
12 4     4   2288 use Biblio::ILL::ISO::UnfilledResults;
  4         10  
  4         104  
13 4     4   26 use Biblio::ILL::ISO::LocationsResults;
  4         7  
  4         80  
14 4     4   2201 use Biblio::ILL::ISO::WillSupplyResults;
  4         11  
  4         129  
15 4     4   28 use Biblio::ILL::ISO::HoldPlacedResults;
  4         8  
  4         87  
16 4     4   22 use Biblio::ILL::ISO::EstimateResults;
  4         7  
  4         86  
17 4     4   19 use Carp;
  4         7  
  4         329  
18              
19             =head1 VERSION
20              
21             Version 0.01
22              
23             =cut
24              
25             our $VERSION = '0.01';
26             #---------------------------------------------------------------------------
27             # Mods
28             # 0.01 - 2003.07.26 - original version
29             #---------------------------------------------------------------------------
30              
31             =head1 DESCRIPTION
32              
33             Biblio::ILL::ISO::RessultsExplanation is a derivation of Biblio::ILL::ISO::ILLASNtype.
34              
35             =head1 USES
36              
37             Biblio::ILL::ISO::ConditionalResults;
38             Biblio::ILL::ISO::RetryResults;
39             Biblio::ILL::ISO::UnfilledResults;
40             Biblio::ILL::ISO::LocationsResults;
41             Biblio::ILL::ISO::WillSupplyResults;
42             Biblio::ILL::ISO::HoldPlacedResults;
43             Biblio::ILL::ISO::EstimateResults;
44              
45             =head1 USED IN
46              
47             Biblio::ILL::ISO::Answer
48              
49             =cut
50              
51 4     4   3078 BEGIN{@ISA = qw ( Biblio::ILL::ISO::ILLASNtype );} # inherit from ILLASNtype
52              
53             =head1 FROM THE ASN DEFINITION
54            
55             Results-Explanation ::= CHOICE {
56             conditional-results [1] Conditional-Results,
57             -- chosen if transaction-results=CONDITIONAL
58             retry-results [2] Retry-Results,
59             -- chosen if transaction-results=RETRY
60             unfilled-results [3] Unfilled-Results,
61             --chosen if transaction-results=UNFILLED
62             locations-results [4] Locations-Results,
63             -- chosen if transaction-results=LOCATIONS-PROVIDED
64             will-supply-results [5] Will-Supply-Results,
65             -- chosen if transaction-results=WILL-SUPPLY
66             hold-placed-results [6] Hold-Placed-Results,
67             -- chosen if transaction-results=HOLD-PLACED
68             estimate-results [7] Estimate-Results
69             -- chosen if transaction-results=ESTIMATE
70             }
71              
72             =cut
73              
74             =head1 METHODS
75              
76             =cut
77              
78             #---------------------------------------------------------------
79             #
80             #---------------------------------------------------------------
81             =head1
82              
83             =head2 new( [$resex] )
84              
85             Creates a new ResultsExplanation object.
86             Expects either no parameters or one of:
87             conditional-results (Biblio::ILL::ISO::ConditionalResults),
88             retry-results (Biblio::ILL::ISO::RetryResults),
89             unfilled-results (Biblio::ILL::ISO::UnfilledResults),
90             locations-results (Biblio::ILL::ISO::LocationsResults),
91             will-supply-results (Biblio::ILL::ISO::WillSupplyResults),
92             hold-placed-results (Biblio::ILL::ISO::HoldPlacedResults), or
93             estimate-results (Biblio::ILL::ISO::EstimateResults).
94              
95             =cut
96             sub new {
97 1     1 1 12 my $class = shift;
98 1         3 my $self = {};
99              
100 1 50       5 if (@_) {
101 1         1 my $resex = shift;
102 1 50       12 if (ref($resex) eq "Biblio::ILL::ISO::ConditionalResults") {
    0          
    0          
    0          
    0          
    0          
    0          
103 1         6 $self->{"conditional-results"} = $resex;
104             } elsif (ref($resex) eq "Biblio::ILL::ISO::RetryResults") {
105 0         0 $self->{"retry-results"} = $resex;
106             } elsif (ref($resex) eq "Biblio::ILL::ISO::UnfilledResults") {
107 0         0 $self->{"unfilled-results"} = $resex;
108             } elsif (ref($resex) eq "Biblio::ILL::ISO::LocationsResults") {
109 0         0 $self->{"locations-results"} = $resex;
110             } elsif (ref($resex) eq "Biblio::ILL::ISO::WillSupplyResults") {
111 0         0 $self->{"will-supply-results"} = $resex;
112             } elsif (ref($resex) eq "Biblio::ILL::ISO::HoldPlacedResults") {
113 0         0 $self->{"hold-placed-results"} = $resex;
114             } elsif (ref($resex) eq "Biblio::ILL::ISO::EstimateResults") {
115 0         0 $self->{"estimate-results"} = $resex;
116             } else {
117             }
118             }
119 1   33     9 bless($self, ref($class) || $class);
120 1         4 return ($self);
121             }
122              
123             #---------------------------------------------------------------
124             #
125             #---------------------------------------------------------------
126             =head1
127              
128             =head2 set( [$resex] )
129              
130             Sets the object's conditional-results (Biblio::ILL::ISO::ConditionalResults),
131             retry-results (Biblio::ILL::ISO::RetryResults),
132             unfilled-results (Biblio::ILL::ISO::UnfilledResults),
133             locations-results (Biblio::ILL::ISO::LocationsResults),
134             will-supply-results (Biblio::ILL::ISO::WillSupplyResults),
135             hold-placed-results (Biblio::ILL::ISO::HoldPlacedResults), or
136             estimate-results (Biblio::ILL::ISO::EstimateResults).
137              
138             =cut
139             sub set {
140 0     0 1   my $self = shift;
141              
142 0           my $resex = shift;
143 0 0         if (ref($resex) eq "Biblio::ILL::ISO::ConditionalResults") {
    0          
    0          
    0          
    0          
    0          
    0          
144 0           $self->{"conditional-results"} = $resex;
145             } elsif (ref($resex) eq "Biblio::ILL::ISO::RetryResults") {
146 0           $self->{"retry-results"} = $resex;
147             } elsif (ref($resex) eq "Biblio::ILL::ISO::UnfilledResults") {
148 0           $self->{"unfilled-results"} = $resex;
149             } elsif (ref($resex) eq "Biblio::ILL::ISO::LocationsResults") {
150 0           $self->{"locations-results"} = $resex;
151             } elsif (ref($resex) eq "Biblio::ILL::ISO::WillSupplyResults") {
152 0           $self->{"will-supply-results"} = $resex;
153             } elsif (ref($resex) eq "Biblio::ILL::ISO::HoldPlacedResults") {
154 0           $self->{"hold-placed-results"} = $resex;
155             } elsif (ref($resex) eq "Biblio::ILL::ISO::EstimateResults") {
156 0           $self->{"estimate-results"} = $resex;
157             } else {
158             }
159              
160 0           return;
161             }
162              
163              
164             #---------------------------------------------------------------
165             #
166             #---------------------------------------------------------------
167             =head1
168              
169             =head2 from_asn($href)
170              
171             Given a properly formatted hash, builds the object.
172              
173             =cut
174             sub from_asn {
175 0     0 1   my $self = shift;
176 0           my $href = shift;
177              
178 0           foreach my $k (keys %$href) {
179             #print ref($self) . "...$k\n";
180              
181 0 0         if ($k =~ /^conditional-results$/) {
    0          
    0          
    0          
    0          
    0          
    0          
182 0           $self->{$k} = new Biblio::ILL::ISO::ConditionalResults();
183 0           $self->{$k}->from_asn($href->{$k});
184             } elsif ($k =~ /^retry-results$/) {
185 0           $self->{$k} = new Biblio::ILL::ISO::RetryResults();
186 0           $self->{$k}->from_asn($href->{$k});
187             } elsif ($k =~ /^unfilled-results$/) {
188 0           $self->{$k} = new Biblio::ILL::ISO::UnfilledResults();
189 0           $self->{$k}->from_asn($href->{$k});
190             } elsif ($k =~ /^locations-results$/) {
191 0           $self->{$k} = new Biblio::ILL::ISO::LocationsResults();
192 0           $self->{$k}->from_asn($href->{$k});
193             } elsif ($k =~ /^will-supply-results$/) {
194 0           $self->{$k} = new Biblio::ILL::ISO::WillSupplyResults();
195 0           $self->{$k}->from_asn($href->{$k});
196             } elsif ($k =~ /^hold-placed-results$/) {
197 0           $self->{$k} = new Biblio::ILL::ISO::HoldPlacedResults();
198 0           $self->{$k}->from_asn($href->{$k});
199             } elsif ($k =~ /^estimate-results$/) {
200 0           $self->{$k} = new Biblio::ILL::ISO::EstimateResults();
201 0           $self->{$k}->from_asn($href->{$k});
202             } else {
203 0           croak "invalid " . ref($self) . " element: [$k]";
204             }
205              
206             }
207 0           return $self;
208             }
209              
210             =head1 SEE ALSO
211              
212             See the README for system design notes.
213             See the parent class(es) for other available methods.
214              
215             For more information on Interlibrary Loan standards (ISO 10160/10161),
216             a good place to start is:
217              
218             http://www.nlc-bnc.ca/iso/ill/main.htm
219              
220             =cut
221              
222             =head1 AUTHOR
223              
224             David Christensen,
225              
226             =cut
227              
228              
229             =head1 COPYRIGHT AND LICENSE
230              
231             Copyright 2003 by David Christensen
232              
233             This library is free software; you can redistribute it and/or modify it
234             under the same terms as Perl itself.
235              
236             =cut
237             =head1
238              
239             =head2 from_asn($href)
240              
241             Given a properly formatted hash, builds the object.
242              
243             =cut
244              
245             1;