|
|
|
@ -63,12 +63,12 @@ sub parse {
|
|
|
|
|
|
|
|
|
|
my $PREFIX = $self->{_prefix}; |
|
|
|
|
return $self->error("not looks like $PREFIX line") |
|
|
|
|
unless $line and $line =~ m{^$PREFIX:}oi; |
|
|
|
|
unless $line and $line =~ m{^$PREFIX:}i; |
|
|
|
|
return $self->error("passed custom fields order not ARRAY ref") |
|
|
|
|
unless $format and ref($format) eq 'ARRAY'; |
|
|
|
|
|
|
|
|
|
chomp $line; |
|
|
|
|
$line =~ s{^$PREFIX:\s*}{}oi; |
|
|
|
|
$line =~ s{^$PREFIX:\s*}{}i; |
|
|
|
|
my $fieldcnt = scalar @{ $format }; |
|
|
|
|
my @values = split /,\s*/o, $line, $fieldcnt; |
|
|
|
|
# check that values count match fields count |
|
|
|
@ -125,7 +125,7 @@ sub get_format_line {
|
|
|
|
|
my ($self) = @_; |
|
|
|
|
|
|
|
|
|
my @keys = @{ $self->{_format} }; |
|
|
|
|
my @names = map { $FIELDS{$_}->{name} } @keys; |
|
|
|
|
my @names = map { $self->{_fields}->{$_}->{name} } @keys; |
|
|
|
|
|
|
|
|
|
my $line = 'Format: ' . join(', ' => @names); |
|
|
|
|
|
|
|
|
|