TAP::Parser should be *easier* to subclass

Eric Wilhelm scratchcomputing at gmail.com
Tue Jun 3 16:58:55 UTC 2008


# from Steve Purkis
# on Tuesday 03 June 2008 03:04:

> I put together a patch for that (follow link above)

Indeed, we had concluded that the constructors needed to not be 
hard-wired.

  +sub _source_class      { 'TAP::Parser::Source' }
  +sub _perl_source_class { 'TAP::Parser::Source::Perl' }
  +sub _iterator_class    { 'TAP::Parser::Iterator' }
  +sub _grammar_class     { 'TAP::Parser::Grammar' }

I think you're headed in the right direction, but these should probably 
not start with '_', and in fact they could just be instance attributes 
(with mutators) so you don't even have to subclass TAP::Parser to 
change this behavior for a given instance.

This would need to be documented.

>To make it even easier to subclass, I would recommend introducing a
> common base class for *all* TAP:: modules in the distro, eg:
> TAP::Base. The reason? Because there are currently a hundred
> different customized 'new' methods

I'm not sure where the benefit is here.  Could you please clarify a bit?  
Is it about code reuse or just consistency?  Collecting some of the 
common method definitions into a single spot doesn't have to mean a 
base class.

Unfortunately, compatibility and minimal dependencies dictate that Moose 
and other class composition tools cannot be used.

--Eric
-- 
"It is a mistake to allow any mechanical object to realize that you are 
in a hurry."
--Ralph's Observation
---------------------------------------------------
    http://scratchcomputing.com
---------------------------------------------------


More information about the tapx-dev mailing list