lib/Biblio/ILL/ISO/ClientId.pm

filter: Statementstmt 60.0% 21 / 35 Branchbran 25.0% 4 / 16 Conditioncond 11.1% 1 / 9 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 71.4% 5 / 7 Podpod 100% 3 / 3 totaltotal 45.3% 34 / 75 CC 13 SCAR 26.8
CC
13
Cov
43%
from_asn
30.0
set
20.0
new
7.0
CRAP 14.5
« lib/Biblio/ILL/ISO/Expired.pm ↑ Summary lib/Biblio/ILL/ISO/Amount.pm »
1 package Biblio::ILL::ISO::ClientId;
2  
3 =head1 NAME
4  
5 Biblio::ILL::ISO::ClientId
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::ILLString;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 4 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 =head1 VERSION
15  
16 Version 0.01
17  
18 =cut
19 4 our $VERSION = '0.01';
20 #---------------------------------------------------------------------------
21 # Mods
22 # 0.01 - 2003.07.15 - original version
23 #---------------------------------------------------------------------------
24  
25 =head1 DESCRIPTION
26  
27 Biblio::ILL::ISO::ClientId is a derivation of Biblio::ILL::ISO::ILLASNtype.
28  
29 =head1 USES
30  
31 Biblio::ILL::ISO::ILLString
32  
33 =head1 USED IN
34  
35 Biblio::ILL::ISO::Request
36 Biblio::ILL::ISO::Shipped
37  
38 =cut
39  
40 4 ▶BEGIN{@ISA = qw ( Biblio::ILL::ISO::ILLASNtype );} # inherit from ILLASNtype
Subroutine BEGIN: called CC=1 SCAR=0.0
41  
42 =head1 FROM THE ASN DEFINITION
43
44 Client-Id ::= SEQUENCE {
45 client-name [0] ILL-String OPTIONAL,
46 client-status [1] ILL-String OPTIONAL,
47 client-identifier [2] ILL-String OPTIONAL
48 }
49  
50 =cut
51  
52 =head1 METHODS
53  
54 =cut
55  
56 #---------------------------------------------------------------
57 #
58 #---------------------------------------------------------------
59 =head1
60  
61 =head2 new( [ [$name], [$status], [$id] ] )
62  
63 Creates a new ClientId object. Expects either no parameters, or
64 1, 2, or 3 text strings. Pass in empty strings ("") as placeholders.
65  
66 =cut
67 3 ▶sub new {
Subroutine new: called CC=6 SCAR=19.4
Pod documented
68 3 my $class = shift;
69 3 my $self = {};
70  
71 3 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 3 0 3
72 3 my ($name, $status, $identifier) = @_;
73
74 3 ▶ $self->{"client-name"} = new Biblio::ILL::ISO::ILLString($name) if ($name);
Branch: 1 branch
BranchTrueFalseTotal
if $name 3 0 3
75 3 ▶ $self->{"client-status"} = new Biblio::ILL::ISO::ILLString($status) if ($status);
Branch: 1 branch
BranchTrueFalseTotal
if $status 3 0 3
76 3 ▶ $self->{"client-identifier"} = new Biblio::ILL::ISO::ILLString($identifier) if ($identifier);
Branch: 1 branch
BranchTrueFalseTotal
if $identifier 3 0 3
77 }
78  
79 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
80 3 return ($self);
81 }
82  
83  
84 #---------------------------------------------------------------
85 #
86 #---------------------------------------------------------------
87 =head1
88  
89 =head2 set(( [ [$name], [$status], [$id] ] )
90  
91 Sets the object's client-name, client-status, and/or client-identifier.
92 Expects 1, 2, or 3 text strings. Pass in empty strings ("") as placeholders.
93  
94 =cut
95 0 ▶sub set {
Subroutine set: not called CC=4 SCAR=30.0
Pod documented
96 0 my $self = shift;
97 0 my ($name, $status, $identifier) = @_;
98
99 0 ▶ $self->{"client-name"} = new Biblio::ILL::ISO::ILLString($name) if ($name);
Branch: 1 branch
BranchTrueFalseTotal
if $name 0 0 0
100 0 ▶ $self->{"client-status"} = new Biblio::ILL::ISO::ILLString($status) if ($status);
Branch: 1 branch
BranchTrueFalseTotal
if $status 0 0 0
101 0 ▶ $self->{"client-identifier"} = new Biblio::ILL::ISO::ILLString($identifier) if ($identifier);
Branch: 1 branch
BranchTrueFalseTotal
if $identifier 0 0 0
102  
103 0 return;
104 }
105  
106 #---------------------------------------------------------------
107 #
108 #---------------------------------------------------------------
109 =head1
110  
111 =head2 from_asn($href)
112  
113 Given a properly formatted hash, builds the object.
114  
115 =cut
116 0 ▶sub from_asn {
Subroutine from_asn: not called CC=5 SCAR=34.0
Pod documented
117 0 my $self = shift;
118 0 my $href = shift;
119  
120 0 foreach my $k (keys %$href) {
121 #print ref($self) . "...$k\n";
122  
123 0 ▶ if (($k =~ /^client-name$/)
Branch: 1 branch
BranchTrueFalseTotal
if ($k =~ /^client-name$/ or $k =~ /^client-status$/ or $k =~ /^client-identifier$/) { } 0 0 0
Condition0%0/6
$k =~ /^client-name$/ or $k =~ /^client-status$/ or $k =~ /^client-identifier$/
l!l&&r!l&&!r
000
$k =~ /^client-name$/ or $k =~ /^client-status$/
l!l&&r!l&&!r
000
MC/DC0%0/3
$k =~ /^client-name$/ or $k =~ /^client-status$/ or $k =~ /^client-identifier$/
$k =~ /^client-name$/ $k =~ /^client-status$/ $k =~ /^client-identifier$/
Truth table0%0/4
A or B or C
A= $k =~ /^client-name$/B= $k =~ /^client-status$/C= $k =~ /^client-identifier$/
ABCresult
1XX1
01X1
0011
0000
124 || ($k =~ /^client-status$/)
125 || ($k =~ /^client-identifier$/)
126 ) {
127 0 $self->{$k} = new Biblio::ILL::ISO::ILLString();
128 0 $self->{$k}->from_asn($href->{$k});
129
130 } else {
131 0 croak "invalid " . ref($self) . " element: [$k]";
132 }
133  
134 }
135 0 return $self;
136 }
137  
138 =head1 SEE ALSO
139  
140 See the README for system design notes.
141 See the parent class(es) for other available methods.
142  
143 For more information on Interlibrary Loan standards (ISO 10160/10161),
144 a good place to start is:
145  
146 http://www.nlc-bnc.ca/iso/ill/main.htm
147  
148 =cut
149  
150 =head1 AUTHOR
151  
152 David Christensen, <DChristensenSPAMLESS@westman.wave.ca>
153  
154 =cut
155  
156  
157 =head1 COPYRIGHT AND LICENSE
158  
159 Copyright 2003 by David Christensen
160  
161 This library is free software; you can redistribute it and/or modify it
162 under the same terms as Perl itself.
163  
164 =cut
165  
166 4 1;
« lib/Biblio/ILL/ISO/Expired.pm ↑ Summary lib/Biblio/ILL/ISO/Amount.pm »