lib/Biblio/ILL/ISO/ResponderOptionalMessageType.pm

filter: Statementstmt 56.8% 29 / 51 Branchbran 20.8% 5 / 24 Conditioncond 16.6% 1 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 75.0% 6 / 8 Podpod 66.6% 2 / 3 totaltotal 44.7% 43 / 96 CC 16 SCAR 30.0
CC
16
Cov
43%
from_asn
42.0
set
30.0
new
7.9
CRAP 20.1
« lib/Biblio/ILL/ISO/ConditionalReply.pm ↑ Summary lib/Biblio/ILL/ISO/RequesterOptionalMessageType.pm »
1 package Biblio::ILL::ISO::ResponderOptionalMessageType;
2  
3 =head1 NAME
4  
5 Biblio::ILL::ISO::ResponderOptionalMessageType
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::ResponderRECEIVED;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 4 ▶use Biblio::ILL::ISO::ResponderRETURNED;
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.27 - original version
25 #---------------------------------------------------------------------------
26  
27 =head1 DESCRIPTION
28  
29 Biblio::ILL::ISO::ResponderOptionalMessageType is a derivation of Biblio::ILL::ISO::ILLASNtype.
30  
31 =head1 USES
32  
33 Biblio::ILL::ISO::ResponderRECEIVED
34 Biblio::ILL::ISO::ResponderRETURNED
35  
36 =head1 USED IN
37  
38 Biblio::ILL::ISO::Answer
39 Biblio::ILL::ISO::Shipped
40  
41 =cut
42  
43 4 ▶BEGIN{@ISA = qw ( Biblio::ILL::ISO::ILLASNtype );} # inherit from ILLASNtype
Subroutine BEGIN: called CC=1 SCAR=0.0
44  
45 =head1 FROM THE ASN DEFINITION
46 # From the ASN
47 #
48 #Responder-Optional-Messages-Type ::= EXPLICIT SEQUENCE {
49 # can-send-SHIPPED [0] IMPLICIT BOOLEAN,
50 # can-send-CHECKED-IN [1] IMPLICIT BOOLEAN,
51 # responder-RECEIVED [2] IMPLICIT ENUMERATED {
52 # requires (1),
53 # desires (2),
54 # neither (3)
55 # }
56 # responder-RETURNED [3] IMPLICIT ENUMERATED {
57 # requires (1),
58 # desires (2),
59 # neither (3)
60 # }
61 # }
62 #
63 =cut
64  
65 =head1 METHODS
66  
67 =cut
68  
69 #---------------------------------------------------------------
70 #
71 #---------------------------------------------------------------
72 =head1
73  
74 =head2 new( $can_send_shipped, $can_send_checked_in, $responder_received, $responder_returned )
75  
76 Creates a new ResponderOptionalMessageType object.
77 Expects a can-send-SHIPPED flag ( 0|1 ),
78 a can-send-CHECKED-IN flag ( 0|1 ),
79 a responder-RECEIVED string (a valid Biblio::ILL::ISO::ResponderRECEIVED enumerated value), and
80 a responder-RETURNED string (a valid Biblio::ILL::ISO::ResponderRETURNED enumerated value).
81  
82 =cut
83 3 ▶sub new {
Subroutine new: called CC=7 SCAR=20.6
Pod documented
84 3 my $class = shift;
85 3 my $self = {};
86  
87 3 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 3 0 3
88 3 my ($bshipped, $bcheckedin, $sreceived, $sreturned) = @_;
89
90 3 ▶ croak "missing ResponderOptionalMessageType parameter can-send-SHIPPED" unless $bshipped;
Branch: 1 branch
BranchTrueFalseTotal
unless $bshipped 0 3 3
91 3 ▶ croak "missing ResponderOptionalMessageType parameter can-send-CHECKED-IN" unless $bcheckedin;
Branch: 1 branch
BranchTrueFalseTotal
unless $bcheckedin 0 3 3
92 3 ▶ croak "missing ResponderOptionalMessageType parameter responder-RECEIVED" unless $sreceived;
Branch: 1 branch
BranchTrueFalseTotal
unless $sreceived 0 3 3
93 3 ▶ croak "missing ResponderOptionalMessageType parameter responder-RETURNED" unless $sreturned;
Branch: 1 branch
BranchTrueFalseTotal
unless $sreturned 0 3 3
94  
95 3 $self->{"can-send-SHIPPED"} = $bshipped;
96 3 $self->{"can-send-CHECKED-IN"} = $bcheckedin;
97 3 $self->{"responder-RECEIVED"} = new Biblio::ILL::ISO::ResponderRECEIVED($sreceived);
98 3 $self->{"responder-RETURNED"} = new Biblio::ILL::ISO::ResponderRETURNED($sreturned);
99 }
100  
101 3 ▶ bless($self, ref($class) || $class);
Condition33%1/3
ref $class || $class
l!l&&r!l&&!r
030
MC/DC0%0/2
ref $class || $class
ref $class $class
Truth table33%1/3
A || B
A= ref $classB= $class
ABresult
1X1
011
000
102 3 return ($self);
103 }
104  
105  
106 #---------------------------------------------------------------
107 #
108 #---------------------------------------------------------------
109 =head1
110  
111 =head2 new( $can_send_shipped, $can_send_checked_in, $responder_received, $responder_returned )
112  
113 Sets the object's can-send-SHIPPED flag ( 0|1 ),
114 can-send-CHECKED-IN flag ( 0|1 ),
115 responder-RECEIVED string (a valid Biblio::ILL::ISO::ResponderRECEIVED enumerated value), and
116 responder-RETURNED string (a valid Biblio::ILL::ISO::ResponderRETURNED enumerated value).
117  
118 =cut
119 0 ▶sub set {
Subroutine set: not called CC=5 SCAR=34.0
Pod undocumented
120 0 my $self = shift;
121 0 my ($bshipped, $bcheckedin, $sreceived, $sreturned) = @_;
122
123 0 ▶ croak "missing ResponderOptionalMessageType parameter can-send-SHIPPED" unless $bshipped;
Branch: 1 branch
BranchTrueFalseTotal
unless $bshipped 0 0 0
124 0 ▶ croak "missing ResponderOptionalMessageType parameter can-send-CHECKED-IN" unless $bcheckedin;
Branch: 1 branch
BranchTrueFalseTotal
unless $bcheckedin 0 0 0
125 0 ▶ croak "missing ResponderOptionalMessageType parameter responder-RECEIVED" unless $sreceived;
Branch: 1 branch
BranchTrueFalseTotal
unless $sreceived 0 0 0
126 0 ▶ croak "missing ResponderOptionalMessageType parameter responder-RETURNED" unless $sreturned;
Branch: 1 branch
BranchTrueFalseTotal
unless $sreturned 0 0 0
127  
128 0 $self->{"can-send-SHIPPED"} = $bshipped;
129 0 $self->{"can-send-CHECKED-IN"} = $bcheckedin;
130 0 $self->{"responder-RECEIVED"} = new Biblio::ILL::ISO::ResponderRECEIVED($sreceived);
131 0 $self->{"responder-RETURNED"} = new Biblio::ILL::ISO::ResponderRETURNED($sreturned);
132  
133 0 return;
134 }
135  
136 #---------------------------------------------------------------
137 #
138 #---------------------------------------------------------------
139 =head1
140  
141 =head2 from_asn($href)
142  
143 Given a properly formatted hash, builds the object.
144  
145 =cut
146 0 ▶sub from_asn {
Subroutine from_asn: not called CC=6 SCAR=37.4
Pod documented
147 0 my $self = shift;
148 0 my $href = shift;
149  
150 0 foreach my $k (keys %$href) {
151 #print ref($self) . "...$k\n";
152  
153 0 ▶ if (($k =~ /^can-send-SHIPPED$/)
Branch: 3 branches
BranchTrueFalseTotal
if ($k =~ /^can-send-SHIPPED$/ or $k =~ /^can-send-CHECKED-IN$/) { } 0 0 0
elsif ($k =~ /^responder-RECEIVED$/) { } 0 0 0
elsif ($k =~ /^responder-RETURNED$/) { } 0 0 0
Condition0%0/3
$k =~ /^can-send-SHIPPED$/ or $k =~ /^can-send-CHECKED-IN$/
l!l&&r!l&&!r
000
MC/DC0%0/2
$k =~ /^can-send-SHIPPED$/ or $k =~ /^can-send-CHECKED-IN$/
$k =~ /^can-send-SHIPPED$/ $k =~ /^can-send-CHECKED-IN$/
Truth table0%0/3
A or B
A= $k =~ /^can-send-SHIPPED$/B= $k =~ /^can-send-CHECKED-IN$/
ABresult
1X1
011
000
154 || ($k =~ /^can-send-CHECKED-IN$/)
155 ) {
156 0 $self->{$k} = $href->{$k};
157  
158 } elsif ($k =~ /^responder-RECEIVED$/) {
159 0 $self->{$k} = new Biblio::ILL::ISO::ResponderRECEIVED();
160 0 $self->{$k}->from_asn($href->{$k});
161  
162 } elsif ($k =~ /^responder-RETURNED$/) {
163 0 $self->{$k} = new Biblio::ILL::ISO::ResponderRETURNED();
164 0 $self->{$k}->from_asn($href->{$k});
165  
166 } else {
167 0 croak "invalid " . ref($self) . " element: [$k]";
168 }
169  
170 }
171 0 return $self;
172 }
173  
174 =head1 SEE ALSO
175  
176 See the README for system design notes.
177 See the parent class(es) for other available methods.
178  
179 For more information on Interlibrary Loan standards (ISO 10160/10161),
180 a good place to start is:
181  
182 http://www.nlc-bnc.ca/iso/ill/main.htm
183  
184 =cut
185  
186 =head1 AUTHOR
187  
188 David Christensen, <DChristensenSPAMLESS@westman.wave.ca>
189  
190 =cut
191  
192  
193 =head1 COPYRIGHT AND LICENSE
194  
195 Copyright 2003 by David Christensen
196  
197 This library is free software; you can redistribute it and/or modify it
198 under the same terms as Perl itself.
199  
200 =cut
201  
202 4 1;
« lib/Biblio/ILL/ISO/ConditionalReply.pm ↑ Summary lib/Biblio/ILL/ISO/RequesterOptionalMessageType.pm »