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 reply to Re: Testing -- making a new constructor behave differently for one package
by chromatic
in thread Testing -- making a new constructor behave differently for one package
by tj_thompson
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |