File Coverage

blib/lib/Biblio/ILL/ISO/SendToListType.pm
Criterion Covered Total %
statement 27 47 57.4
branch 7 24 29.1
condition 1 3 33.3
subroutine 7 9 77.7
pod 3 3 100.0
total 45 86 52.3


line stmt bran cond sub pod time code
1             package Biblio::ILL::ISO::SendToListType;
2              
3             =head1 NAME
4              
5             Biblio::ILL::ISO::SendToListType
6              
7             =cut
8              
9 4     4   630 use Biblio::ILL::ISO::ILLASNtype;
  4         6  
  4         232  
10 4     4   23 use Biblio::ILL::ISO::SystemId;
  4         5  
  4         87  
11 4     4   21 use Biblio::ILL::ISO::AccountNumber;
  4         8  
  4         84  
12 4     4   24 use Biblio::ILL::ISO::SystemAddress;
  4         7  
  4         82  
13              
14 4     4   21 use Carp;
  4         24  
  4         2273  
15              
16             =head1 VERSION
17              
18             Version 0.01
19              
20             =cut
21              
22             our $VERSION = '0.01';
23             #---------------------------------------------------------------------------
24             # Mods
25             # 0.01 - 2003.07.15 - original version
26             #---------------------------------------------------------------------------
27              
28             =head1 DESCRIPTION
29              
30             Biblio::ILL::ISO::SendToListType is a derivation of Biblio::ILL::ISO::ILLASNtype.
31              
32             =head1 USES
33              
34             Biblio::ILL::ISO::SystemId
35             Biblio::ILL::ISO::AccountNumber
36             Biblio::ILL::ISO::SystemAddress
37              
38             =head1 USED IN
39              
40             Each of these uses Biblio::ILL::ISO::SendToListTypeSequence, which is
41             a sequence of SendToListType:
42              
43             Biblio::ILL::ISO::Answer
44             Biblio::ILL::ISO::Request
45             Biblio::ILL::ISO::ThirdPartyInfoType
46              
47             =cut
48              
49 4     4   2143 BEGIN{@ISA = qw ( Biblio::ILL::ISO::ILLASNtype );} # inherit from ILLASNtype
50              
51             =head1 FROM THE ASN DEFINITION
52            
53             (see SendToListTypeSequence.pm)
54              
55             Send-To-List-Type ::= SEQUENCE OF SEQUENCE {
56             system-id [0] IMPLICIT System-Id,
57             account-number [1] Account-Number OPTIONAL,
58             system-address [2] IMPLICIT System-Address OPTIONAL
59             }
60              
61             =cut
62              
63             =head1 METHODS
64              
65             =cut
66              
67             #---------------------------------------------------------------
68             #
69             #---------------------------------------------------------------
70             =head1
71              
72             =head2 new( $system_id [,$account_number] [,$system_address] )
73              
74             Creates a new SendToListType object.
75             Expects a system-id (Biblio::ILL::ISO::SystemId),
76             (optionally) an account-number (Biblio::ILL::ISO::AccountNumber), and
77             (optionally) a system-address (Biblio::ILL::ISO::SystemAddress)
78              
79             =cut
80             sub new {
81 6     6 1 10 my $class = shift;
82 6         10 my $self = {};
83              
84 6 50       18 if (@_) {
85 6         20 my ($refSystemId, $refAccountNumber, $refSystemAddress) = @_;
86            
87 6 50       28 croak "missing System-Id" unless $refSystemId;
88 6 50       19 croak "invalid System-Id" unless (ref($refSystemId) eq "Biblio::ILL::ISO::SystemId");
89              
90 6         12 $self->{"system-id"} = $refSystemId;
91 6 100       31 $self->{"account-number"} = $refAccountNumber if ($refAccountNumber);
92 6 100       22 $self->{"system-address"} = $refSystemAddress if ($refSystemAddress);
93             }
94              
95 6   33     30 bless($self, ref($class) || $class);
96 6         47 return ($self);
97             }
98              
99              
100             #---------------------------------------------------------------
101             #
102             #---------------------------------------------------------------
103             =head1
104              
105             =head2 set( $system_id [,$account_number] [,$system_address] )
106              
107             Sets the object's system-id (Biblio::ILL::ISO::SystemId),
108             (optionally) account-number (Biblio::ILL::ISO::AccountNumber), and
109             (optionally) system-address (Biblio::ILL::ISO::SystemAddress)
110              
111             =cut
112             sub set {
113 0     0 1   my $self = shift;
114 0           my ($refSystemId, $refAccountNumber, $refSystemAddress) = @_;
115            
116 0 0         croak "missing System-Id" unless $refSystemId;
117 0 0         croak "invalid System-Id" unless (ref($refSystemId) eq "Biblio::ILL::ISO::SystemId");
118            
119 0           $self->{"system-id"} = $refSystemId;
120 0 0         $self->{"account-number"} = $refAccountNumber if ($refAccountNumber);
121 0 0         $self->{"system-address"} = $refSystemAddress if ($refSystemAddress);
122              
123 0           return;
124             }
125              
126             #---------------------------------------------------------------
127             #
128             #---------------------------------------------------------------
129             =head1
130              
131             =head2 from_asn($href)
132              
133             Given a properly formatted hash, builds the object.
134              
135             =cut
136             sub from_asn {
137 0     0 1   my $self = shift;
138 0           my $href = shift;
139              
140 0           foreach my $k (keys %$href) {
141             #print ref($self) . "...$k\n";
142              
143 0 0         if ($k =~ /^system-id$/) {
    0          
    0          
144 0           $self->{$k} = new Biblio::ILL::ISO::SystemId();
145 0           $self->{$k}->from_asn($href->{$k});
146              
147             } elsif ($k =~ /^account-number$/) {
148 0           $self->{$k} = new Biblio::ILL::ISO::AccountNumber();
149 0           $self->{$k}->from_asn($href->{$k});
150              
151             } elsif ($k =~ /^system-address$/) {
152 0           $self->{$k} = new Biblio::ILL::ISO::SystemAddress();
153 0           $self->{$k}->from_asn($href->{$k});
154              
155             } else {
156 0           croak "invalid " . ref($self) . " element: [$k]";
157             }
158              
159             }
160 0           return $self;
161             }
162              
163             =head1 SEE ALSO
164              
165             See the README for system design notes.
166             See the parent class(es) for other available methods.
167              
168             For more information on Interlibrary Loan standards (ISO 10160/10161),
169             a good place to start is:
170              
171             http://www.nlc-bnc.ca/iso/ill/main.htm
172              
173             =cut
174              
175             =head1 AUTHOR
176              
177             David Christensen,
178              
179             =cut
180              
181              
182             =head1 COPYRIGHT AND LICENSE
183              
184             Copyright 2003 by David Christensen
185              
186             This library is free software; you can redistribute it and/or modify it
187             under the same terms as Perl itself.
188              
189             =cut
190              
191             1;