| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Finance::AMEX::Transaction::EPPRC::Base; | 
| 2 |  |  |  |  |  |  | $Finance::AMEX::Transaction::EPPRC::Base::VERSION = '0.003'; | 
| 3 | 7 |  |  | 7 |  | 54 | use strict; | 
|  | 7 |  |  |  |  | 14 |  | 
|  | 7 |  |  |  |  | 177 |  | 
| 4 | 7 |  |  | 7 |  | 33 | use warnings; | 
|  | 7 |  |  |  |  | 13 |  | 
|  | 7 |  |  |  |  | 1406 |  | 
| 5 |  |  |  |  |  |  |  | 
| 6 |  |  |  |  |  |  | # ABSTRACT: Parse AMEX Chargeback Notification Files (EPPRC) Base methods | 
| 7 |  |  |  |  |  |  |  | 
| 8 |  |  |  |  |  |  | sub new { | 
| 9 | 1131 |  |  | 1131 | 1 | 3673 | my ($class, %props) = @_; | 
| 10 |  |  |  |  |  |  | my $self = bless { | 
| 11 |  |  |  |  |  |  | _line => $props{line}, | 
| 12 | 1131 |  |  |  |  | 3670 | }, $class; | 
| 13 |  |  |  |  |  |  |  | 
| 14 | 1131 |  |  |  |  | 4141 | return $self; | 
| 15 |  |  |  |  |  |  | } | 
| 16 |  |  |  |  |  |  |  | 
| 17 |  |  |  |  |  |  | sub line { | 
| 18 | 0 |  |  | 0 | 1 | 0 | my ($self) = @_; | 
| 19 | 0 |  |  |  |  | 0 | return $self->{_line}; | 
| 20 |  |  |  |  |  |  | } | 
| 21 |  |  |  |  |  |  |  | 
| 22 |  |  |  |  |  |  | sub _get_column { | 
| 23 | 28492 |  |  | 28492 |  | 67839 | my ($self, $field) = @_; | 
| 24 | 28492 |  |  |  |  | 75582 | my $map = $self->field_map->{$field}; | 
| 25 |  |  |  |  |  |  |  | 
| 26 |  |  |  |  |  |  | # if the line is not long enough to handle the start of the field, | 
| 27 |  |  |  |  |  |  | # it is an optional field that we don't have | 
| 28 | 28492 | 100 |  |  |  | 194802 | if (length($self->{_line}) < $map->[0]) { | 
| 29 | 24 |  |  |  |  | 151 | return ''; | 
| 30 |  |  |  |  |  |  | } | 
| 31 |  |  |  |  |  |  |  | 
| 32 | 28468 |  |  |  |  | 76971 | my $ret = substr($self->{_line}, $map->[0] - 1, $map->[1]); | 
| 33 | 28468 |  |  |  |  | 108925 | $ret =~ s{\s+\z}{}; | 
| 34 | 28468 |  |  |  |  | 160017 | return $ret; | 
| 35 |  |  |  |  |  |  | } | 
| 36 |  |  |  |  |  |  |  | 
| 37 |  |  |  |  |  |  | 1; | 
| 38 |  |  |  |  |  |  |  | 
| 39 |  |  |  |  |  |  | __END__ |