Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • I think it should probably look something like this:

    - Parser module - has a base set of things it can parse plus some sort of registration method(s) to add new parseable things. Presumably the registering code provides a regex and an event name. This would probably be implemented by sublcassing.

    - When a match is encountered, the parser just generates an event describing the match. This event is passed on to the output generator(s), which do whatever they want with it.

    This nicely separates parsing from output generation and makes the parser reasonable extensible. Note that I completely glossed over the issue of the order in which matches are attempted, as this is kind of sticky ;)