line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Finance::AMEX::Transaction; |
2
|
|
|
|
|
|
|
$Finance::AMEX::Transaction::VERSION = '0.004'; |
3
|
8
|
|
|
8
|
|
615649
|
use strict; |
|
8
|
|
|
|
|
88
|
|
|
8
|
|
|
|
|
257
|
|
4
|
8
|
|
|
8
|
|
46
|
use warnings; |
|
8
|
|
|
|
|
16
|
|
|
8
|
|
|
|
|
250
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# ABSTRACT: Parse AMEX transaction files: EPRAW, EPPRC, EPTRN, CBNOT, GRRCN |
7
|
|
|
|
|
|
|
|
8
|
8
|
|
|
8
|
|
3985
|
use Finance::AMEX::Transaction::CBNOT; |
|
8
|
|
|
|
|
23
|
|
|
8
|
|
|
|
|
248
|
|
9
|
8
|
|
|
8
|
|
3860
|
use Finance::AMEX::Transaction::EPRAW; |
|
8
|
|
|
|
|
28
|
|
|
8
|
|
|
|
|
312
|
|
10
|
8
|
|
|
8
|
|
4282
|
use Finance::AMEX::Transaction::EPPRC; |
|
8
|
|
|
|
|
31
|
|
|
8
|
|
|
|
|
269
|
|
11
|
8
|
|
|
8
|
|
4102
|
use Finance::AMEX::Transaction::EPTRN; |
|
8
|
|
|
|
|
27
|
|
|
8
|
|
|
|
|
287
|
|
12
|
8
|
|
|
8
|
|
3770
|
use Finance::AMEX::Transaction::GRRCN; |
|
8
|
|
|
|
|
29
|
|
|
8
|
|
|
|
|
2431
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub new { |
15
|
8
|
|
|
8
|
1
|
3169
|
my ($class, %props) = @_; |
16
|
|
|
|
|
|
|
|
17
|
8
|
|
|
|
|
55
|
my $self = bless { |
18
|
|
|
|
|
|
|
_file_type => undef, |
19
|
|
|
|
|
|
|
_file_format => undef, |
20
|
|
|
|
|
|
|
_parser => undef, |
21
|
|
|
|
|
|
|
}, $class; |
22
|
|
|
|
|
|
|
|
23
|
8
|
|
|
|
|
62
|
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
|
8
|
|
|
|
|
61
|
$self->{_file_type} = $props{file_type}; |
32
|
8
|
|
|
|
|
28
|
$self->{_file_format} = $props{file_format}; |
33
|
|
|
|
|
|
|
|
34
|
8
|
50
|
33
|
|
|
34
|
if ($self->file_type and exists $type_map->{$self->file_type}) { |
35
|
8
|
|
|
|
|
33
|
$self->{_parser} = $type_map->{$self->file_type}->new(file_format => $self->file_format); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
8
|
|
|
|
|
44
|
return $self; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub file_type { |
42
|
24
|
|
|
24
|
1
|
58
|
my ($self) = @_; |
43
|
|
|
|
|
|
|
|
44
|
24
|
|
|
|
|
139
|
return $self->{_file_type}; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub file_format { |
48
|
8
|
|
|
8
|
1
|
24
|
my ($self) = @_; |
49
|
|
|
|
|
|
|
|
50
|
8
|
|
|
|
|
77
|
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
|
1294
|
|
|
1294
|
1
|
24837
|
my ($self, $fh) = @_; |
61
|
|
|
|
|
|
|
|
62
|
1294
|
|
|
|
|
8416
|
my $line = <$fh>; |
63
|
1294
|
|
|
|
|
4848
|
return $self->parse_line($line); |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub parse_line { |
67
|
1294
|
|
|
1294
|
1
|
4579
|
my ($self, $line) = @_; |
68
|
|
|
|
|
|
|
|
69
|
1294
|
|
|
|
|
8311
|
my $ret = $self->{_parser}->parse_line($line); |
70
|
1294
|
|
|
|
|
4328
|
return $ret; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
1; |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
__END__ |