NAME
oEdtk::RecordParser - stream reader and dispatcher over an Infinite flux
SYNOPSIS
use oEdtk::RecordParser;
my $p = oEdtk::RecordParser->new($fh, %records);
while ( my ($id, $vals) = $p->next ) {
# $id is the record identifier, $vals a hashref (or an arrayref
# for the denormalized record)
}
DESCRIPTION
Reads records from an Infinite flux and dispatches each line to the matching oEdtk::Record. A compiled seek plan (the keys in lexicographic order, each paired with its compiled match) is built once in "new", so "next" does not re-sort or re-compile the keys on every record.
METHODS
new
my $p = oEdtk::RecordParser->new($fh, %records);
Build a parser over the file handle $fh and the %records table (identifier to oEdtk::Record). Undef records are ignored; a non-record value is an error.
next
my ($id, $vals) = $p->next;
Read and dispatch the next record. FLUX lines are skipped; the denormalized record returns an array reference of split fields, any other record returns a hash reference of parsed values. An exhausted stream returns an empty list.
dumper
my $text = $p->dumper($value);
Return Data::Dumper::Dumper of $value (debug helper).
set_skip_line
$p->set_skip_line($value);
Append $value to the prefix that marks a line to skip.
set_mute_record
$p->set_mute_record($value);
Append $value to the muted-record name.
set_mute_id
$p->set_mute_id($value);
Append $value to the muted-record identifier.
set_line_record
$p->set_line_record($value);
Append $value to the line-record name.
set_key_offset
$p->set_key_offset($value);
Append $value to the key offset.
set_key_size
$p->set_key_size($value);
Append $value to the key size.
set_denormalized_record
$p->set_denormalized_record($value);
Set the denormalized-record name on both the mainline and the fork keys.
set_denormalized_option_record
$p->set_denormalized_option_record($value);
Set the fork's denormalized-option key only.
set_denormalized_on_record
$p->set_denormalized_on_record($value);
Set the fork's denormalized-on key only.
add_motif_to_denormalized_split
$p->add_motif_to_denormalized_split($motif);
Append $motif to the split pattern used for the denormalized record.
set_motif_to_denormalized_split
$p->set_motif_to_denormalized_split($motif);
Replace the split pattern used for the denormalized record.
The private helpers _seek_plan and _kill_non_latin_chars build the seek plan and gate the non-Latin-1 cleanup; they are not part of the public API.
AUTHOR
The oEdtk team.