note
stvn
<P>
This is interesting. It reminds me of [cpan://Test::MockObject] and the more recently uploaded [cpan://Test::MockModule] in functionality, but for more general purpose use. I do have a few comments though.
</P>
<P>
To start with the name is horrible. "Stubber" is just a weird word and you are probably better off just using [cpan://Module::Stub] which is not yet taken.
</P>
<P>
Second, since <CODE>use</CODE> statements run at compile time, I would suggest offering an alternate interface for compile time stub-ing. Something like this.
<CODE>
use Module::Stubber (
'Foo::Bar' => {
new => sub { bless {}, $_[0]; },
stringify => sub { "$_[0]"; }
});
</CODE>
The code to do so would be simple enough.
</P>
<P>
Also I would be sure the stub module is properly added to the %INC hash, otherwise <CODE>require</CODE> and <CODE>use</CODE> will try to load the real module. (you may have already done this, but you didn't post code, so I don't know).
</P>
<P>
Your description describes a number wonderous possibilites which your module opens up to it's user (hooking into CPAN, alternate @LIB directories, etc). I would create some of those possibilities, either as subclasses of your module or as plug-ins of some kind. Otherwise they are just empty promises.
Doing so will also serve to illustrate the use of your module far better than any textual description can. It will also increase the usefulness of your module to a larger audience for whom writing such code is out of their range of skills.
</P>
<div class="pmsig"><div class="pmsig-315586">
-stvn
</div></div>
411225
411225