File Coverage

blib/lib/Biblio/ILL/ISO/SystemId.pm
Criterion Covered Total %
statement 34 53 64.1
branch 2 10 20.0
condition 1 3 33.3
subroutine 9 12 75.0
pod 7 7 100.0
total 53 85 62.3


line stmt bran cond sub pod time code
1             package Biblio::ILL::ISO::SystemId;
2              
3             =head1 NAME
4              
5             Biblio::ILL::ISO::SystemId
6              
7             =cut
8              
9 4     4   23 use Biblio::ILL::ISO::ILLASNtype;
  4         7  
  4         122  
10 4     4   2463 use Biblio::ILL::ISO::PersonOrInstitutionSymbol;
  4         12  
  4         116  
11 4     4   2785 use Biblio::ILL::ISO::NameOfPersonOrInstitution;
  4         11  
  4         106  
12              
13 4     4   163 use Carp;
  4         11  
  4         340  
14              
15             =head1 VERSION
16              
17             Version 0.01
18              
19             =cut
20             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     4   2714 BEGIN{@ISA = qw ( Biblio::ILL::ISO::ILLASNtype );} # inherit from ILLASNtype
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             sub new {
75 89     89 1 457 my $class = shift;
76 89         129 my $self = {};
77              
78 89 100       209 if (@_) {
79 56         195 $self->{"person-or-institution-symbol"} = new Biblio::ILL::ISO::PersonOrInstitutionSymbol(shift);
80             }
81 89   33     356 bless($self, ref($class) || $class);
82 89         313 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             sub as_string {
97 0     0 1 0 my $self = shift;
98              
99 0 0       0 return $self->{"person-or-institution-symbol"}->as_string() if ($self->{"person-or-institution-symbol"});
100 0 0       0 return $self->{"name-of-person-or-institution"}->as_string() if ($self->{"name-of-person-or-institution"});
101 0         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             sub set_person_symbol {
117 0     0 1 0 my $self = shift;
118 0         0 my ($s) = @_;
119              
120 0         0 $self->{"person-or-institution-symbol"} = new Biblio::ILL::ISO::PersonOrInstitutionSymbol();
121 0         0 $self->{"person-or-institution-symbol"}->set_person_symbol($s);
122              
123 0         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             sub set_institution_symbol {
138 3     3 1 16 my $self = shift;
139 3         5 my ($s) = @_;
140              
141 3         12 $self->{"person-or-institution-symbol"} = new Biblio::ILL::ISO::PersonOrInstitutionSymbol();
142 3         15 $self->{"person-or-institution-symbol"}->set_institution_symbol($s);
143              
144 3         16 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             sub set_person_name {
159 26     26 1 121 my $self = shift;
160 26         40 my ($s) = @_;
161              
162 26         123 $self->{"name-of-person-or-institution"} = new Biblio::ILL::ISO::NameOfPersonOrInstitution();
163 26         83 $self->{"name-of-person-or-institution"}->set_person_name($s);
164              
165 26         52 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             sub set_institution_name {
180 7     7 1 28 my $self = shift;
181 7         20 my ($s) = @_;
182              
183 7         26 $self->{"name-of-person-or-institution"} = new Biblio::ILL::ISO::NameOfPersonOrInstitution();
184 7         24 $self->{"name-of-person-or-institution"}->set_institution_name($s);
185              
186 7         13 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             sub from_asn {
200 0     0 1   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 0         if ($k =~ /^person-or-institution-symbol$/) {
    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,
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             1;