lib/Biblio/ILL/ISO/AlreadyForwarded.pm

filter: Statementstmt 59.0% 26 / 44 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% 41 / 82 CC 14 SCAR 26.3
CC
14
Cov
46%
set
30.0
from_asn
20.0
new
8.2
CRAP 13.9
« lib/Biblio/ILL/ISO/ProviderErrorReport.pm ↑ Summary lib/Biblio/ILL/ISO/StateTransitionProhibited.pm »
1 package Biblio::ILL::ISO::AlreadyForwarded;
2  
3 =head1 NAME
4  
5 Biblio::ILL::ISO::AlreadyForwarded
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::SystemId;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 4 ▶use Biblio::ILL::ISO::SystemAddress;
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::AlreadyForwarded is a derivation of Biblio::ILL::ISO::ILLASNtype.
30  
31 =head1 USES
32  
33 Biblio::ILL::ISO::SystemId
34 Biblio::ILL::ISO::SystemAddress
35  
36 =head1 USED IN
37  
38 Biblio::ILL::ISO::UserErrorReport
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 Already-Forwarded ::= EXPLICIT SEQUENCE {
47 responder-id [0] IMPLICIT System-Id,
48 responder-address [1] IMPLICIT System-Address OPTIONAL
49 }
50  
51 =cut
52  
53 =head1 METHODS
54  
55 =cut
56 #---------------------------------------------------------------
57 #
58 #---------------------------------------------------------------
59 =head1
60  
61 =head2 new($system_id [, $system_addr])
62  
63 Creates a new AlreadyForwarded object. Expects either no parameters, or
64 a valid Biblio::ILL::ISO::SystemId and (optionally) a valid Biblio::ILL::ISO::SystemAddress.
65  
66 =cut
67 1 ▶sub new {
Subroutine new: called CC=7 SCAR=21.1
Pod documented
68 1 my $class = shift;
69 1 my $self = {};
70  
71 1 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 1 0 1
72 1 my ($id, $addr) = @_;
73  
74 1 ▶ croak "invalid responder-id" unless (ref($id) eq "Biblio::ILL::ISO::SystemId");
Branch: 1 branch
BranchTrueFalseTotal
unless ref $id eq "Biblio::ILL::ISO::SystemId" 0 1 1
75 1 ▶ if ($addr) {
Branch: 1 branch
BranchTrueFalseTotal
if ($addr) 1 0 1
76 1 ▶ croak "invalid responder-address" unless (ref($addr) eq "Biblio::ILL::ISO::SystemAddress");
Branch: 1 branch
BranchTrueFalseTotal
unless ref $addr eq "Biblio::ILL::ISO::SystemAddress" 0 1 1
77 }
78
79 1 $self->{"responder-id"} = $id;
80 1 ▶ $self->{"responder-address"} = $addr if ($addr);
Branch: 1 branch
BranchTrueFalseTotal
if $addr 1 0 1
81 }
82  
83 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
84 1 return ($self);
85 }
86  
87  
88 #---------------------------------------------------------------
89 #
90 #---------------------------------------------------------------
91 =head1
92  
93 =head2 set($system_id [, $system_addr])
94  
95 Sets the object's responder-id (a Biblio::ILL::ISO::SystemId) and (optionally) responder-address
96 (a Biblio::ILL::ISO::SystemAddress).
97  
98 =cut
99 0 ▶sub set {
Subroutine set: not called CC=5 SCAR=34.0
Pod documented
100 0 my $self = shift;
101  
102 0 my ($id, $addr) = @_;
103  
104 0 ▶ croak "invalid responder-id" unless (ref($id) eq "Biblio::ILL::ISO::SystemId");
Branch: 1 branch
BranchTrueFalseTotal
unless ref $id eq "Biblio::ILL::ISO::SystemId" 0 0 0
105 0 ▶ if ($addr) {
Branch: 1 branch
BranchTrueFalseTotal
if ($addr) 0 0 0
106 0 ▶ croak "invalid responder-address" unless (ref($addr) eq "Biblio::ILL::ISO::SystemAddress");
Branch: 1 branch
BranchTrueFalseTotal
unless ref $addr eq "Biblio::ILL::ISO::SystemAddress" 0 0 0
107 }
108
109 0 $self->{"responder-id"} = $id;
110 0 ▶ $self->{"responder-address"} = $addr if ($addr);
Branch: 1 branch
BranchTrueFalseTotal
if $addr 0 0 0
111  
112 0 return;
113 }
114  
115  
116 #---------------------------------------------------------------
117 #
118 #---------------------------------------------------------------
119 =head1
120  
121 =head2 from_asn($href)
122  
123 Given a properly formatted hash, builds the object.
124  
125 =cut
126 0 ▶sub from_asn {
Subroutine from_asn: not called CC=4 SCAR=30.0
Pod documented
127 0 my $self = shift;
128 0 my $href = shift;
129  
130 0 foreach my $k (keys %$href) {
131 #print ref($self) . "...$k\n";
132  
133 0 ▶ if ($k =~ /^responder-id$/) {
Branch: 2 branches
BranchTrueFalseTotal
if ($k =~ /^responder-id$/) { } 0 0 0
elsif ($k =~ /^responder-address$/) { } 0 0 0
134 0 $self->{$k} = new Biblio::ILL::ISO::SystemId();
135 0 $self->{$k}->from_asn($href->{$k});
136  
137 } elsif ($k =~ /^responder-address$/) {
138 0 $self->{$k} = new Biblio::ILL::ISO::SystemAddress();
139 0 $self->{$k}->from_asn($href->{$k});
140  
141 } else {
142 0 croak "invalid " . ref($self) . " element: [$k]";
143 }
144  
145 }
146 0 return $self;
147 }
148  
149 =head1 SEE ALSO
150  
151 See the README for system design notes.
152 See the parent class(es) for other available methods.
153  
154 For more information on Interlibrary Loan standards (ISO 10160/10161),
155 a good place to start is:
156  
157 http://www.nlc-bnc.ca/iso/ill/main.htm
158  
159 =cut
160  
161 =head1 AUTHOR
162  
163 David Christensen, <DChristensenSPAMLESS@westman.wave.ca>
164  
165 =cut
166  
167  
168 =head1 COPYRIGHT AND LICENSE
169  
170 Copyright 2003 by David Christensen
171  
172 This library is free software; you can redistribute it and/or modify it
173 under the same terms as Perl itself.
174  
175 =cut
176  
177 4 1;
« lib/Biblio/ILL/ISO/ProviderErrorReport.pm ↑ Summary lib/Biblio/ILL/ISO/StateTransitionProhibited.pm »