- or download this
package RecordParser::FixedWidth;
# constructor takes the name of the source file
sub new {
my ( $class, $source ) = @_;
- or download this
my $template;
my @fields;
my @column_specs = lookup_specs($source);
...
push @fields, $field;
}
open my $reader, '<', $source;
- or download this
my $obj = {
IO => $reader,
template => $template,
...
};
bless $obj => $class;
}
- or download this
sub next {
my ( $self ) = @_;
my ($reader, $template, $fields_ref)
...
my $record = <$reader>;
return unless defined $record;
- or download this
my %value_of;
my @values = unpack($template, $record);
@value_of{@fields} = @values;
- or download this
return \%value_of;
}