* Luke Closs <[EMAIL PROTECTED]> [2007-02-23 17:30]: > On 2/23/07, A. Pagaltzis <[EMAIL PROTECTED]> wrote: > >That will not call the importer in the right package. > > To expand on this answer, without funky voodoo, after loading > mock::LWP::Simple perl won't think it had loaded LWP::Simple. > So later if your module under test does 'use LWP::Simple', perl > will load the real one.
I was actually just thinking of the fact that `use Foo` means BEGIN { require Foo; eval { Foo->import } } and if you make it `use mock::Foo`, that will turn into BEGIN { require mock::Foo; eval { mock::Foo->import } } which means the import method will never actually be called. But your observation is even more important than that. * brian d foy <[EMAIL PROTECTED]> [2007-02-25 18:40]: > That's not so hard to fix though. The mock class just needs to > know how to tell Perl it's already loaded whatever its mocking. > It's not that funky, at least compared to what the proposed > pragma does. It’s exactly the same kind of funky voodoo that the proposed pragma would perform: populate %INC with the proper entry. Although it might be implemented with a less funky-looking syntax. Regards, -- Aristotle Pagaltzis // <http://plasmasturm.org/>