NAME

    Text::FixedWidth::Parser - Used to parse the fixed width text file 

DESCRIPTION

    The Text::FixedWidth::Parser module allows you to read fixed width text file by specifying string mapper

SYNOPSIS

 use Text::FixedWidth::Parser;

 FileData
 ~~~~~~~~
 ADDRESS001XXXXX YYYYYYY84 SOUTH STREET USA
 MARK0018286989020140101         
 ADDRESS002YYYYYYY      69 BELL STREET  UK 
 MARK0028869893920140101         

 my $string_mapper = [
       {
           Rule => {
               LinePrefix => [1, 7],
               Expression => "LinePrefix eq 'ADDRESS'"
           },
           Id   => [8,  3],
           Name => [11, 13],
           Address => {DoorNo => [24, 2], Street => [26, 14]},
           Country => [40, 3]
       },
       {
           Rule => {
               LinePrefix => [1, 4],
               Expression => "LinePrefix eq 'MARK'"
           },
           Id                 => [5,  3],
           Mark1              => [8,  2],
           Mark2              => [10, 2],
           Mark3              => [12, 2],
           Mark4              => [14, 3],
           ResultDate         => [15, 8],
           ResultDatePattern  => '%Y%m%d',
           ResultDateTimezone => 'America/Chicago'
       }
 ];


 # StringMapper should be passed while creating object
 my $obj = Text::FixedWidth::Parser->new( 
               { 
                  #Required Params
                  StringMapper  => $string_mapper,
                  #optional Params
                  TimestampToEpochFields => ['ResultDate'],
                  DefaultDatePattern     => '%Y%m%d',
                  DefaultTimezone        => 'GMT',
                  ConcateString          => '', 
                  EmptyAsUndef           => 1
               }
           );

 open my $fh, '<', 'filename';

 $data = $obj->read($fh);

PARAMS

METHODS

LICENSE

This library is free software; you can redistribute and/or modify it under the same terms as Perl itself.

AUTHORS

Venkatesan Narayanan, venkatesanmusiri@gmail.com