lib/Biblio/ILL/ISO/StatusReport.pm

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