in reply to My first package - need help getting started

another non-OO way of doing things popped into my head. theres a module for processing NetFlow records ( module CFlow out of the flow-tools package, not on CPAN ) that does things like this:

sub match_func { return 0 unless $bytes > 5000; return 0 unless $src_port == 80; # do_something with matched return 1; } CFlow::loop( \&match_func, $filehandle ); print "matched $CFlow::match_count records\n";

since you generally work with a single record, if the fields of the record are unique... forget all of the OO stuff and use globals. the 'loop' routine takes a coderef to be run after each record is parsed (and shoved into the global variables) and a filehandle ( if filehandle is undef, read STDIN, if filehandle is a string, open and use that file.). the coderef returns 0 if the record wasn't interesting, else it does whatever and returns 1 (so the module can keep track of how many records matched).

while not-00, it does do an excellent job of hiding the details from the user, eliminates all of the derefrencing ( $chunk->type() just becomes $type) which makes it easy to write quick one-off scripts.

sub fix_building { return 0 unless $building eq 'FOO'; $building eq 'BAR'; print_rec; return 1; } DBParserThingy::loop ( \&fix_building );