This is pretty close to the approach i use as well, except that i usually dispense with the top-level subroutine and use an anonymous block instead. I also, therefore, need to put the
itself outside of that block. However, most of my classes that
have the parser as part of the class's data, so evey new object uses the same parser. Saves on resources.