lib/Biblio/ILL/ISO/SystemId.pm

filter: Statementstmt 65.4% 36 / 55 Branchbran 20.0% 2 / 10 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 75.0% 9 / 12 Podpod 100% 7 / 7 totaltotal 61.8% 55 / 89 CC 8 SCAR 19.6
CC
8
Cov
57%
from_asn
20.0
as_string
12.0
new
3.1
CRAP 7.1
« lib/Biblio/ILL/ISO/SystemAddress.pm ↑ Summary lib/Biblio/ILL/ISO/ISODate.pm »
1 package Biblio::ILL::ISO::SystemId;
2  
3 =head1 NAME
4  
5 Biblio::ILL::ISO::SystemId
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::PersonOrInstitutionSymbol;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 4 ▶use Biblio::ILL::ISO::NameOfPersonOrInstitution;
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 4 our $VERSION = '0.01';
21 #---------------------------------------------------------------------------
22 # Mods
23 # 0.01 - 2003.07.15 - original version
24 #---------------------------------------------------------------------------
25  
26 =head1 DESCRIPTION
27  
28 Biblio::ILL::ISO::SystemId is a derivation of Biblio::ILL::ISO::ILLASNtype.
29  
30 =head1 USES
31  
32 Biblio::ILL::ISO::PersonOrInstitutionSymbol
33 Biblio::ILL::ISO::NameOfPersonOrInstitution
34  
35 =head1 USED IN
36  
37 Biblio::ILL::ISO::AlreadyForwarded
38 Biblio::ILL::ISO::AlreadyTriedListType
39 Biblio::ILL::ISO::EDeliveryDetails
40 Biblio::ILL::ISO::HistoryReport
41 Biblio::ILL::ISO::LocationInfo
42 Biblio::ILL::ISO::SendToListType
43 Biblio::ILL::ISO::TransactionId
44  
45 =cut
46 4 ▶BEGIN{@ISA = qw ( Biblio::ILL::ISO::ILLASNtype );} # inherit from ILLASNtype
Subroutine BEGIN: called CC=1 SCAR=0.0
47  
48 =head1 FROM THE ASN DEFINITION
49
50 System-Id ::= SEQUENCE {
51 --at least one of the following must be present
52 person-or-institution-symbol [0] Person-Or-Institution-Symbol OPTIONAL,
53 name-of-person-or-institution [1] Name-Of-Person-Or-Institution OPTIONAL
54 }
55  
56 =cut
57  
58 =head1 METHODS
59  
60 =cut
61  
62 #---------------------------------------------------------------
63 #
64 #---------------------------------------------------------------
65 =head1
66  
67 =head2 new( [$person_or_institution_symbol] )
68  
69 Creates a new SystemId object.
70 Expects either no paramaters, or
71 (optionally) a person or institution symbol (Biblio::ILL::ISO::PersonOrInstitutionSymbol).
72  
73 =cut
74 89 ▶sub new {
Subroutine new: called CC=3 SCAR=11.2
Pod documented
75 89 my $class = shift;
76 89 my $self = {};
77  
78 89 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 56 33 89
79 56 $self->{"person-or-institution-symbol"} = new Biblio::ILL::ISO::PersonOrInstitutionSymbol(shift);
80 }
81 89 ▶ bless($self, ref($class) || $class);
Condition33%1/3
ref $class || $class
l!l&&r!l&&!r
0890
MC/DC0%0/2
ref $class || $class
ref $class $class
Truth table33%1/3
A || B
A= ref $classB= $class
ABresult
1X1
011
000
82 89 return ($self);
83 }
84  
85  
86 #---------------------------------------------------------------
87 #
88 #---------------------------------------------------------------
89 =head1
90  
91 =head2 as_string( )
92  
93 Returns a stringified representation of the object.
94  
95 =cut
96 0 ▶sub as_string {
Subroutine as_string: not called CC=3 SCAR=24.8
Pod documented
97 0 my $self = shift;
98  
99 0 ▶ return $self->{"person-or-institution-symbol"}->as_string() if ($self->{"person-or-institution-symbol"});
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"person-or-institution-symbol"} 0 0 0
100 0 ▶ return $self->{"name-of-person-or-institution"}->as_string() if ($self->{"name-of-person-or-institution"});
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"name-of-person-or-institution"} 0 0 0
101 0 return "";
102 }
103  
104  
105 #---------------------------------------------------------------
106 #
107 #---------------------------------------------------------------
108 =head1
109  
110 =head2 set_person_symbol( $s )
111  
112 Sets the object's person-or-institution-symbol.
113 Expects a text string.
114  
115 =cut
116 0 ▶sub set_person_symbol {
Subroutine set_person_symbol: not called CC=1 SCAR=6.9
Pod documented
117 0 my $self = shift;
118 0 my ($s) = @_;
119  
120 0 $self->{"person-or-institution-symbol"} = new Biblio::ILL::ISO::PersonOrInstitutionSymbol();
121 0 $self->{"person-or-institution-symbol"}->set_person_symbol($s);
122  
123 0 return;
124 }
125  
126 #---------------------------------------------------------------
127 #
128 #---------------------------------------------------------------
129 =head1
130  
131 =head2 set_institution_symbol( $s )
132  
133 Sets the object's person-or-institution-symbol.
134 Expects a text string.
135  
136 =cut
137 3 ▶sub set_institution_symbol {
Subroutine set_institution_symbol: called CC=1 SCAR=0.0
Pod documented
138 3 my $self = shift;
139 3 my ($s) = @_;
140  
141 3 $self->{"person-or-institution-symbol"} = new Biblio::ILL::ISO::PersonOrInstitutionSymbol();
142 3 $self->{"person-or-institution-symbol"}->set_institution_symbol($s);
143  
144 3 return;
145 }
146  
147 #---------------------------------------------------------------
148 #
149 #---------------------------------------------------------------
150 =head1
151  
152 =head2 set_person_name( $s )
153  
154 Sets the object's name-of-person-or-institution.
155 Expects a text string.
156  
157 =cut
158 26 ▶sub set_person_name {
Subroutine set_person_name: called CC=1 SCAR=0.0
Pod documented
159 26 my $self = shift;
160 26 my ($s) = @_;
161  
162 26 $self->{"name-of-person-or-institution"} = new Biblio::ILL::ISO::NameOfPersonOrInstitution();
163 26 $self->{"name-of-person-or-institution"}->set_person_name($s);
164  
165 26 return;
166 }
167  
168 #---------------------------------------------------------------
169 #
170 #---------------------------------------------------------------
171 =head1
172  
173 =head2 set_institution_name( $s )
174  
175 Sets the object's name-of-person-or-institution.
176 Expects a text string.
177  
178 =cut
179 7 ▶sub set_institution_name {
Subroutine set_institution_name: called CC=1 SCAR=0.0
Pod documented
180 7 my $self = shift;
181 7 my ($s) = @_;
182  
183 7 $self->{"name-of-person-or-institution"} = new Biblio::ILL::ISO::NameOfPersonOrInstitution();
184 7 $self->{"name-of-person-or-institution"}->set_institution_name($s);
185  
186 7 return;
187 }
188  
189 #---------------------------------------------------------------
190 #
191 #---------------------------------------------------------------
192 =head1
193  
194 =head2 from_asn($href)
195  
196 Given a properly formatted hash, builds the object.
197  
198 =cut
199 0 ▶sub from_asn {
Subroutine from_asn: not called CC=4 SCAR=30.0
Pod documented
200 0 my $self = shift;
201 0 my $href = shift;
202  
203 0 foreach my $k (keys %$href) {
204 #print ref($self) . "...$k\n";
205  
206 0 ▶ if ($k =~ /^person-or-institution-symbol$/) {
Branch: 2 branches
BranchTrueFalseTotal
if ($k =~ /^person-or-institution-symbol$/) { } 0 0 0
elsif ($k =~ /^name-of-person-or-institution$/) { } 0 0 0
207 0 $self->{$k} = new Biblio::ILL::ISO::PersonOrInstitutionSymbol();
208 0 $self->{$k}->from_asn($href->{$k});
209  
210 } elsif ($k =~ /^name-of-person-or-institution$/) {
211 0 $self->{$k} = new Biblio::ILL::ISO::NameOfPersonOrInstitution();
212 0 $self->{$k}->from_asn($href->{$k});
213  
214 } else {
215 0 croak "invalid " . ref($self) . " element: [$k]";
216 }
217  
218 }
219 0 return $self;
220 }
221  
222 =head1 SEE ALSO
223  
224 See the README for system design notes.
225 See the parent class(es) for other available methods.
226  
227 For more information on Interlibrary Loan standards (ISO 10160/10161),
228 a good place to start is:
229  
230 http://www.nlc-bnc.ca/iso/ill/main.htm
231  
232 =cut
233  
234 =head1 AUTHOR
235  
236 David Christensen, <DChristensenSPAMLESS@westman.wave.ca>
237  
238 =cut
239  
240  
241 =head1 COPYRIGHT AND LICENSE
242  
243 Copyright 2003 by David Christensen
244  
245 This library is free software; you can redistribute it and/or modify it
246 under the same terms as Perl itself.
247  
248 =cut
249  
250 4 1;
« lib/Biblio/ILL/ISO/SystemAddress.pm ↑ Summary lib/Biblio/ILL/ISO/ISODate.pm »