Perl-Sensitive Sunglasses | |
PerlMonks |
Re: Testing -- making a new constructor behave differently for one packageby chromatic (Archbishop) |
on Jan 27, 2012 at 23:23 UTC ( [id://950467]=note: print w/replies, xml ) | Need Help?? |
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.
In Section
Seekers of Perl Wisdom
|
|