line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Finance::AMEX::Transaction; |
2
|
|
|
|
|
|
|
$Finance::AMEX::Transaction::VERSION = '0.003'; |
3
|
7
|
|
|
7
|
|
456945
|
use strict; |
|
7
|
|
|
|
|
73
|
|
|
7
|
|
|
|
|
196
|
|
4
|
7
|
|
|
7
|
|
38
|
use warnings; |
|
7
|
|
|
|
|
12
|
|
|
7
|
|
|
|
|
194
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# ABSTRACT: Parse AMEX transaction files: EPRAW, EPPRC, EPTRN, CBNOT, GRRCN |
7
|
|
|
|
|
|
|
|
8
|
7
|
|
|
7
|
|
3015
|
use Finance::AMEX::Transaction::CBNOT; |
|
7
|
|
|
|
|
18
|
|
|
7
|
|
|
|
|
192
|
|
9
|
7
|
|
|
7
|
|
2976
|
use Finance::AMEX::Transaction::EPRAW; |
|
7
|
|
|
|
|
20
|
|
|
7
|
|
|
|
|
204
|
|
10
|
7
|
|
|
7
|
|
2946
|
use Finance::AMEX::Transaction::EPPRC; |
|
7
|
|
|
|
|
19
|
|
|
7
|
|
|
|
|
203
|
|
11
|
7
|
|
|
7
|
|
3076
|
use Finance::AMEX::Transaction::EPTRN; |
|
7
|
|
|
|
|
22
|
|
|
7
|
|
|
|
|
209
|
|
12
|
7
|
|
|
7
|
|
2891
|
use Finance::AMEX::Transaction::GRRCN; |
|
7
|
|
|
|
|
24
|
|
|
7
|
|
|
|
|
2137
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub new { |
15
|
7
|
|
|
7
|
1
|
2669
|
my ($class, %props) = @_; |
16
|
|
|
|
|
|
|
|
17
|
7
|
|
|
|
|
41
|
my $self = bless { |
18
|
|
|
|
|
|
|
_file_type => undef, |
19
|
|
|
|
|
|
|
_file_format => undef, |
20
|
|
|
|
|
|
|
_parser => undef, |
21
|
|
|
|
|
|
|
}, $class; |
22
|
|
|
|
|
|
|
|
23
|
7
|
|
|
|
|
49
|
my $type_map = { |
24
|
|
|
|
|
|
|
EPRAW => 'Finance::AMEX::Transaction::EPRAW', |
25
|
|
|
|
|
|
|
EPPRC => 'Finance::AMEX::Transaction::EPPRC', |
26
|
|
|
|
|
|
|
EPTRN => 'Finance::AMEX::Transaction::EPTRN', |
27
|
|
|
|
|
|
|
CBNOT => 'Finance::AMEX::Transaction::CBNOT', |
28
|
|
|
|
|
|
|
GRRCN => 'Finance::AMEX::Transaction::GRRCN', |
29
|
|
|
|
|
|
|
}; |
30
|
|
|
|
|
|
|
|
31
|
7
|
|
|
|
|
44
|
$self->{_file_type} = $props{file_type}; |
32
|
7
|
|
|
|
|
22
|
$self->{_file_format} = $props{file_format}; |
33
|
|
|
|
|
|
|
|
34
|
7
|
50
|
33
|
|
|
28
|
if ($self->file_type and exists $type_map->{$self->file_type}) { |
35
|
7
|
|
|
|
|
25
|
$self->{_parser} = $type_map->{$self->file_type}->new(file_format => $self->file_format); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
7
|
|
|
|
|
34
|
return $self; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub file_type { |
42
|
21
|
|
|
21
|
1
|
44
|
my ($self) = @_; |
43
|
|
|
|
|
|
|
|
44
|
21
|
|
|
|
|
120
|
return $self->{_file_type}; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub file_format { |
48
|
7
|
|
|
7
|
1
|
22
|
my ($self) = @_; |
49
|
|
|
|
|
|
|
|
50
|
7
|
|
|
|
|
56
|
return $self->{_file_format}; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub parser { |
54
|
0
|
|
|
0
|
1
|
0
|
my ($self) = @_; |
55
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
0
|
return $self->{_parser}; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub getline { |
60
|
1287
|
|
|
1287
|
1
|
22852
|
my ($self, $fh) = @_; |
61
|
|
|
|
|
|
|
|
62
|
1287
|
|
|
|
|
6167
|
my $line = <$fh>; |
63
|
1287
|
|
|
|
|
3530
|
return $self->parse_line($line); |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub parse_line { |
67
|
1287
|
|
|
1287
|
1
|
3363
|
my ($self, $line) = @_; |
68
|
|
|
|
|
|
|
|
69
|
1287
|
|
|
|
|
5600
|
my $ret = $self->{_parser}->parse_line($line); |
70
|
1287
|
|
|
|
|
3584
|
return $ret; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
1; |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
__END__ |