Moose led to Mouse led to Moo led to Mo led finally to M, which gives you the least object-orientation possible, which is none at all. I quipped that Perl desperately needed a new OO module called Noose - just enough object orientation to hang yourself. (more…)
Posts Tagged ‘moose’
Introducing Noose: just enough OO to hang yourself
Mocking LWP::UserAgent properly
This is an update to an earlier post I wrote about the adventures I had in creating and using a mock
LWP::UserAgent for testing purposes. The ever-vigilant mst overheard a conversation on the same topic, and jumped in. He pointed out that
Test::MockObject (and everything using it) overrides
UNIVERSAL::isa in a way that hides bugs. Because it can hide bugs, it is definitely not safe to use in a test suite, where you're trying to uncover bugs.
The bottom line
Instead of following my earlier advice, use
Test::LWP::UserAgent, a new module which avoids
Test::MockObject and offers a better interface (in particular, the nonsense with subtypes is no longer needed) for creating and using mock
Important update: Don't follow this advice, follow that advice!
chromatic mentioned how to use dependency injection in You're Already Using Dependency Injection. Although I had read that when he posted it, I hadnt actually ever done it. That is, until today. (more…)