line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Math::Calc::Euro; |
2
|
1
|
|
|
1
|
|
6860
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
33
|
|
3
|
1
|
|
|
1
|
|
6
|
use Carp; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
62
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
5
|
use vars '$VERSION'; |
|
1
|
|
|
|
|
11
|
|
|
1
|
|
|
|
|
274
|
|
6
|
|
|
|
|
|
|
$VERSION = 0.02; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
my %rates = qw( LUF 40.3399 ATS 13.76 BEF 40.3399 |
9
|
|
|
|
|
|
|
NLG 2.20371 FIM 5.94574 FRF 6.55957 |
10
|
|
|
|
|
|
|
DEM 1.94483 GRD 340.75 IEP 0.787564 |
11
|
|
|
|
|
|
|
ITL 1936.27 PTE 200.482 ESP 166.386 ); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub new { |
14
|
0
|
|
|
0
|
1
|
|
my ($proto, $currency) = @_; |
15
|
0
|
|
0
|
|
|
|
my $rate = defined $currency && ( |
16
|
|
|
|
|
|
|
$rates{uc $currency} || 0 + $currency |
17
|
|
|
|
|
|
|
) || |
18
|
|
|
|
|
|
|
( ref $proto eq __PACKAGE__ ? |
19
|
|
|
|
|
|
|
$$proto |
20
|
|
|
|
|
|
|
: |
21
|
|
|
|
|
|
|
croak("Invalid currency") |
22
|
|
|
|
|
|
|
); |
23
|
0
|
|
0
|
|
|
|
return bless \$rate, ref($proto) || $proto; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub to_euro { |
27
|
0
|
|
|
0
|
1
|
|
my ($self, $amount) = @_; |
28
|
0
|
|
|
|
|
|
return $amount / $$self; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub to_national { |
32
|
0
|
|
|
0
|
1
|
|
my ($self, $amount) = @_; |
33
|
0
|
|
|
|
|
|
return $amount * $$self; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
0
|
|
|
0
|
1
|
|
sub from_euro { goto &to_national } |
37
|
0
|
|
|
0
|
1
|
|
sub from_national { goto &to_euro } |
38
|
0
|
|
|
0
|
1
|
|
sub clone { goto &new } |
39
|
|
|
|
|
|
|
1; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
__END__ |