in reply to Re: How to mock Mail::Mailer
in thread How to mock Mail::Mailer

Lamprecht,

I don't think the idea is stupid. I have tried it and it is the closest I have got so far. In isolation it seemed to work perfectly. When I tried it in my real-life example it complained about redefining Mail::Mailer::new and the actual file was not as I expected.

What I thought would be most likely to work to would be to take your approach of forcing a testfile and simply redefine the constructor using Test::MockObject::Extends. However I could not get that to work.

I am sure my original approach (and perhaps the above approaches) should be workable. I will keep working on this but in the end it will simply be easiest to make my use of Mail::Mailer more configurable.