I am in the process of completing the work on a parser for
parsing ANSI X12 data/transaction files.
I have named the parser X12::Parser.
Since there are various ANSI X12 data formats, I have comeup with a config file
specification. The user defines this file for the X12 format he wants to parse.
The X12::Cf module reads this config file. The X12::Cf module is used in X12::Parser.
(The module X12::Cf is provided with X12::Parser).
Here's the methods that I am providing with this module.
use X12::Parser;
# Create a parser object
my $p = new X12::Parser;
# Parse a data file based on the configuration file
$p->parse ( file => '837.txt', # <--- file to parse
conf => '837_004010X098.cf' # <--- user created config file
);
# Step through the file
while ( my $loop = $p->get_next_loop ) {
my @loop = $p->get_loop_segments ($loop);
}
# or use this method instead
while ( my ($pos, $loop) = $p->get_next_pos_loop ) {
my @loop = $p->get_segments ($pos);
}
# dump the file to stdout,
$p->print_tree
Pls offer your suggestions on using
the namespace X12::Parser and X12::Cf.
Thanks,
Prasad
_____________________________________________________________
Save rainforest for free with a Planet-Save.com e-mail account:
http://www.planet-save.com