File Coverage

blib/lib/Biblio/ILL/ISO/UnfilledResults.pm
Criterion Covered Total %
statement 24 44 54.5
branch 5 26 19.2
condition 1 3 33.3
subroutine 6 8 75.0
pod 3 3 100.0
total 39 84 46.4


line stmt bran cond sub pod time code
1             package Biblio::ILL::ISO::UnfilledResults;
2              
3             =head1 NAME
4              
5             Biblio::ILL::ISO::UnfilledResults
6              
7             =cut
8              
9 4     4   23 use Biblio::ILL::ISO::ILLASNtype;
  4         8  
  4         96  
10 4     4   2167 use Biblio::ILL::ISO::ReasonUnfilled;
  4         15  
  4         104  
11 4     4   26 use Biblio::ILL::ISO::LocationInfoSequence;
  4         9  
  4         80  
12              
13 4     4   19 use Carp;
  4         8  
  4         305  
14              
15             =head1 VERSION
16              
17             Version 0.01
18              
19             =cut
20              
21             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     4   1842 BEGIN{@ISA = qw ( Biblio::ILL::ISO::ILLASNtype );} # inherit from ILLASNtype
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             sub new {
70 1     1 1 1 my $class = shift;
71 1         2 my $self = {};
72              
73 1 50       4 if (@_) {
74 1         2 my ($reason, $replydate, $locations) = @_;
75              
76 1 50       13 croak "missing unfilled-result reason-unfilled" unless ($reason);
77 1 50       3 croak "invalid unfilled-result reason-unfilled" unless (ref($reason) eq "Biblio::ILL::ISO::ReasonUnfilled");
78              
79 1 50       3 if ($locations) {
80 0 0       0 croak "invalid locations" unless (ref($locations) eq "Biblio::ILL::ISO::LocationInfoSequence");
81             }
82            
83 1         1 $self->{"reason-unfilled"} = $reason;
84 1 50       5 $self->{"locations"} = $locations if ($locations);;
85             }
86              
87 1   33     5 bless($self, ref($class) || $class);
88 1         3 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             sub set {
104 0     0 1   my $self = shift;
105              
106 0           my ($reason, $replydate, $locations) = @_;
107              
108 0 0         croak "missing unfilled-result reason-unfilled" unless ($reason);
109 0 0         croak "invalid unfilled-result reason-unfilled" unless (ref($reason) eq "Biblio::ILL::ISO::ReasonUnfilled");
110              
111 0 0         if ($locations) {
112 0 0         croak "invalid locations" unless (ref($locations) eq "Biblio::ILL::ISO::LocationInfoSequence");
113             }
114            
115 0           $self->{"reason-unfilled"} = $reason;
116 0 0         $self->{"locations"} = $locations if ($locations);;
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             sub from_asn {
132 0     0 1   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 0         if ($k =~ /^reason-unfilled$/) {
    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,
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             1;