line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Biblio::ILL::ISO::Amount; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Biblio::ILL::ISO::Amount |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=cut |
8
|
|
|
|
|
|
|
|
9
|
4
|
|
|
4
|
|
1819
|
use Biblio::ILL::ISO::ILLASNtype; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
119
|
|
10
|
4
|
|
|
4
|
|
2479
|
use Biblio::ILL::ISO::AmountString; |
|
4
|
|
|
|
|
12
|
|
|
4
|
|
|
|
|
109
|
|
11
|
|
|
|
|
|
|
|
12
|
4
|
|
|
4
|
|
24
|
use Carp; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
327
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 VERSION |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
Version 0.02 |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=cut |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
21
|
|
|
|
|
|
|
#--------------------------------------------------------------------------- |
22
|
|
|
|
|
|
|
# Mods |
23
|
|
|
|
|
|
|
# 0.02 - 2003.09.07 - fixed the POD |
24
|
|
|
|
|
|
|
# 0.01 - 2003.07.15 - original version |
25
|
|
|
|
|
|
|
#--------------------------------------------------------------------------- |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 DESCRIPTION |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
Biblio::ILL::ISO::Amount is a derivation of Biblio::ILL::ISO::ILLASNtype. |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 USES |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
Biblio::ILL::ISO::AmountString |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 USED IN |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
Biblio::ILL::ISO::CostInfoType |
38
|
|
|
|
|
|
|
Biblio::ILL::ISO::SupplyDetails |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=cut |
41
|
|
|
|
|
|
|
|
42
|
4
|
|
|
4
|
|
2132
|
BEGIN{@ISA = qw ( Biblio::ILL::ISO::ILLASNtype );} # inherit from ILLASNtype |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 FROM THE ASN DEFINITION |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
Amount ::= SEQUENCE { |
47
|
|
|
|
|
|
|
currency-code [0] IMPLICIT PrintableString OPTIONAL, --(SIZE (3)) |
48
|
|
|
|
|
|
|
-- values defined in ISO 4217-1981 |
49
|
|
|
|
|
|
|
monetary-value [1] IMPLICIT AmountString -- (SIZE (1..10)) |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=cut |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 METHODS |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=cut |
57
|
|
|
|
|
|
|
#--------------------------------------------------------------- |
58
|
|
|
|
|
|
|
# |
59
|
|
|
|
|
|
|
#--------------------------------------------------------------- |
60
|
|
|
|
|
|
|
=head1 |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head2 new([$amount_string [, $currency_code] ]) |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Creates a new Amount object. Expects either no parameters, or |
65
|
|
|
|
|
|
|
a valid Biblio::ILL::ISO::AmountString and (optionally) a 3-character |
66
|
|
|
|
|
|
|
string indicating the currency code. |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=cut |
69
|
|
|
|
|
|
|
sub new { |
70
|
10
|
|
|
10
|
1
|
26
|
my $class = shift; |
71
|
10
|
|
|
|
|
13
|
my $self = {}; |
72
|
|
|
|
|
|
|
|
73
|
10
|
50
|
|
|
|
299
|
if (@_) { |
74
|
10
|
|
|
|
|
16
|
my ($monetary_value, $currency_code) = @_; |
75
|
|
|
|
|
|
|
|
76
|
10
|
50
|
|
|
|
20
|
croak "Missing monetary value" unless ($monetary_value); |
77
|
10
|
|
|
|
|
52
|
$self->{"monetary-value"} = new Biblio::ILL::ISO::AmountString($monetary_value); |
78
|
|
|
|
|
|
|
|
79
|
10
|
100
|
|
|
|
25
|
if ($currency_code) { |
80
|
|
|
|
|
|
|
# currency code is optional |
81
|
1
|
50
|
|
|
|
4
|
croak "Invalid currency code" unless ((length $currency_code) == 3); |
82
|
1
|
50
|
|
|
|
6
|
$self->{"currency-code"} = $currency_code if ($currency_code); |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
10
|
|
33
|
|
|
57
|
bless($self, ref($class) || $class); |
87
|
10
|
|
|
|
|
50
|
return ($self); |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
#--------------------------------------------------------------- |
92
|
|
|
|
|
|
|
# |
93
|
|
|
|
|
|
|
#--------------------------------------------------------------- |
94
|
|
|
|
|
|
|
=head1 |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head2 set($amount_string [, $currence_code]) |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
Sets the object's monetary-value (a Biblio::ILL::ISO::AmountString) and (optionally) |
99
|
|
|
|
|
|
|
currency-code (a 3-character text string). |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=cut |
102
|
|
|
|
|
|
|
sub set { |
103
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
104
|
0
|
|
|
|
|
|
my ($monetary_value, $currency_code) = @_; |
105
|
|
|
|
|
|
|
|
106
|
0
|
0
|
|
|
|
|
croak "Missing monetary value" unless ($monetary_value); |
107
|
0
|
|
|
|
|
|
$self->{"monetary-value"} = new Biblio::ILL::ISO::AmountString($monetary_value); |
108
|
|
|
|
|
|
|
|
109
|
0
|
0
|
|
|
|
|
if ($currency_code) { |
110
|
|
|
|
|
|
|
# currency code is optional |
111
|
0
|
0
|
|
|
|
|
croak "Invalid currency code" unless ((length $currency_code) == 3); |
112
|
0
|
0
|
|
|
|
|
$self->{"currency-code"} = $currency_code if ($currency_code); |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
|
115
|
0
|
|
|
|
|
|
return; |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
#--------------------------------------------------------------- |
120
|
|
|
|
|
|
|
# |
121
|
|
|
|
|
|
|
#--------------------------------------------------------------- |
122
|
|
|
|
|
|
|
=head1 |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head2 from_asn($href) |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
Given a properly formatted hash, builds the object. |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=cut |
129
|
|
|
|
|
|
|
sub from_asn { |
130
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
131
|
0
|
|
|
|
|
|
my $href = shift; |
132
|
|
|
|
|
|
|
|
133
|
0
|
|
|
|
|
|
foreach my $k (keys %$href) { |
134
|
|
|
|
|
|
|
#print ref($self) . "...$k\n"; |
135
|
|
|
|
|
|
|
|
136
|
0
|
0
|
|
|
|
|
if ($k =~ /^monetary-value$/) { |
|
|
0
|
|
|
|
|
|
137
|
0
|
|
|
|
|
|
$self->{$k} = new Biblio::ILL::ISO::AmountString(); |
138
|
0
|
|
|
|
|
|
$self->{$k}->from_asn($href->{$k}); |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
} elsif ($k =~ /^currency-code$/) { |
141
|
0
|
|
|
|
|
|
$self->{$k} = $href->{$k}; |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
} else { |
144
|
0
|
|
|
|
|
|
croak "invalid " . ref($self) . " element: [$k]"; |
145
|
|
|
|
|
|
|
} |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
} |
148
|
0
|
|
|
|
|
|
return $self; |
149
|
|
|
|
|
|
|
} |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=head1 SEE ALSO |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
See the README for system design notes. |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
For more information on Interlibrary Loan standards (ISO 10160/10161), |
156
|
|
|
|
|
|
|
a good place to start is: |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
http://www.nlc-bnc.ca/iso/ill/main.htm |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=cut |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=head1 AUTHOR |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
David Christensen, |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=cut |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
Copyright 2003 by David Christensen |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify it |
174
|
|
|
|
|
|
|
under the same terms as Perl itself. |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=cut |
177
|
|
|
|
|
|
|
1; |