lib/Biblio/ILL/ISO/StateTransitionProhibited.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/AlreadyForwarded.pm ↑ Summary lib/Biblio/ILL/ISO/StatusReport.pm »
1 package Biblio::ILL::ISO::StateTransitionProhibited;
2  
3 =head1 NAME
4  
5 Biblio::ILL::ISO::StateTransitionProhibited
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::ILLAPDUtype;
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.12 - original version
25 #---------------------------------------------------------------------------
26  
27 =head1 DESCRIPTION
28  
29 Biblio::ILL::ISO::StateTransitionProhibited is a derivation of Biblio::ILL::ISO::ILLASNtype.
30  
31 =head1 USES
32  
33 Biblio::ILL::ISO::ILLAPDUtype
34 Biblio::ILL::ISO::CurrentState
35  
36 =head1 USED IN
37  
38 Biblio::ILL::ISO::ProviderErrorReport
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 State-Transition-Prohibited ::= EXPLICIT SEQUENCE {
47 aPDU-type [0] IMPLICIT ILL-APDU-Type,
48 current-state [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( $APDUtype, $current_state )
63  
64 Creates a new StateTransitionProhibited object.
65 Expects an APDU-type (Biblio::ILL::ISO::ILLAPDUtype), and
66 the current state (Biblio::ILL::ISO::CurrentState).
67  
68 =cut
69 1 ▶sub new {
Subroutine new: called CC=7 SCAR=20.9
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 ($itype, $cs) = @_;
75
76 1 ▶ croak "missing aPDU-type" unless ($itype);
Branch: 1 branch
BranchTrueFalseTotal
unless $itype 0 1 1
77 1 ▶ croak "invalid aPDU-type" unless (ref($itype) eq "Biblio::ILL::ISO::ILLAPDUtype");
Branch: 1 branch
BranchTrueFalseTotal
unless ref $itype eq "Biblio::ILL::ISO::ILLAPDUtype" 0 1 1
78 1 ▶ croak "missing current-state" unless ($cs);
Branch: 1 branch
BranchTrueFalseTotal
unless $cs 0 1 1
79 1 ▶ croak "invalid current-state" unless (ref($cs) eq "Biblio::ILL::ISO::CurrentState");
Branch: 1 branch
BranchTrueFalseTotal
unless ref $cs eq "Biblio::ILL::ISO::CurrentState" 0 1 1
80  
81 1 $self->{"aPDU-type"} = $itype;
82 1 $self->{"current-state"} = $cs;
83 }
84  
85 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
86 1 return ($self);
87 }
88  
89  
90 #---------------------------------------------------------------
91 #
92 #---------------------------------------------------------------
93 =head1
94  
95 =head2 set( $APDUtype, $current_state )
96  
97 Sets the object's aPDU-type (Biblio::ILL::ISO::ILLAPDUtype), and
98 current-state (Biblio::ILL::ISO::CurrentState).
99  
100 =cut
101 0 ▶sub set {
Subroutine set: not called CC=5 SCAR=34.0
Pod documented
102 0 my $self = shift;
103 0 my ($itype, $cs) = @_;
104
105 0 ▶ croak "missing aPDU-type" unless ($itype);
Branch: 1 branch
BranchTrueFalseTotal
unless $itype 0 0 0
106 0 ▶ croak "invalid aPDU-type" unless (ref($itype) eq "Biblio::ILL::ISO::ILLAPDUtype");
Branch: 1 branch
BranchTrueFalseTotal
unless ref $itype eq "Biblio::ILL::ISO::ILLAPDUtype" 0 0 0
107 0 ▶ croak "missing current-state" unless ($cs);
Branch: 1 branch
BranchTrueFalseTotal
unless $cs 0 0 0
108 0 ▶ croak "invalid current-state" unless (ref($cs) eq "Biblio::ILL::ISO::CurrentState");
Branch: 1 branch
BranchTrueFalseTotal
unless ref $cs eq "Biblio::ILL::ISO::CurrentState" 0 0 0
109
110 0 $self->{"aPDU-type"} = $itype;
111 0 $self->{"current-state"} = $cs;
112
113 0 return;
114 }
115  
116  
117 #---------------------------------------------------------------
118 #
119 #---------------------------------------------------------------
120 =head1
121  
122 =head2 from_asn($href)
123  
124 Given a properly formatted hash, builds the object.
125  
126 =cut
127 0 ▶sub from_asn {
Subroutine from_asn: not called CC=4 SCAR=30.0
Pod documented
128 0 my $self = shift;
129 0 my $href = shift;
130  
131 0 foreach my $k (keys %$href) {
132 #print ref($self) . "...$k\n";
133  
134 0 ▶ if ($k =~ /^aPDU-type$/) {
Branch: 2 branches
BranchTrueFalseTotal
if ($k =~ /^aPDU-type$/) { } 0 0 0
elsif ($k =~ /^current-state$/) { } 0 0 0
135 0 $self->{$k} = new Biblio::ILL::ISO::ILLAPDUType();
136 0 $self->{$k}->from_asn($href->{$k});
137  
138 } elsif ($k =~ /^current-state$/) {
139 0 $self->{$k} = new Biblio::ILL::ISO::CurrentState();
140 0 $self->{$k}->from_asn($href->{$k});
141  
142 } else {
143 0 croak "invalid " . ref($self) . " element: [$k]";
144 }
145  
146 }
147 0 return $self;
148 }
149  
150 =head1 SEE ALSO
151  
152 See the README for system design notes.
153 See the parent class(es) for other available methods.
154  
155 For more information on Interlibrary Loan standards (ISO 10160/10161),
156 a good place to start is:
157  
158 http://www.nlc-bnc.ca/iso/ill/main.htm
159  
160 =cut
161  
162 =head1 AUTHOR
163  
164 David Christensen, <DChristensenSPAMLESS@westman.wave.ca>
165  
166 =cut
167  
168  
169 =head1 COPYRIGHT AND LICENSE
170  
171 Copyright 2003 by David Christensen
172  
173 This library is free software; you can redistribute it and/or modify it
174 under the same terms as Perl itself.
175  
176 =cut
177  
178 4 1;
« lib/Biblio/ILL/ISO/AlreadyForwarded.pm ↑ Summary lib/Biblio/ILL/ISO/StatusReport.pm »