in reply to Testing -- making a new constructor behave differently for one package
I wrote about the way I solve this problem in You're Already Using Dependency Injection. In short, rather than hardcoding the name of a class to construct within your constructor, make the constructed object parametric—whether from passing an allomorphic equivalent to the constructor, using the default object, or overriding the accessor/builder from a subclass.
Improve your skills with Modern Perl: the free book.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Testing -- making a new constructor behave differently for one package
by tj_thompson (Monk) on Jan 27, 2012 at 23:39 UTC |