in reply to Is it ok to mix functional and oo programming in one package?
A typical test for me is something like:
The extra line to create the object isn't a lot of overhead; and myself I just think of the method call ($bf->) as just a short alias for Image::BoxFinder::.{ my $test_name = "rect_probe"; my $bf = Image::BoxFinder->new(); my $spot = $bf->rect_probe; is_deeply( $spot, [ 0, 0 ], "Testing $test_name: found rectangle"); }
On the subject of mixing and matching methods and proceedures in one module: this makes some people queasy, and I have mild reservations about it myself, though they're only mild.
On the subject of modules with both an object and a proceedural interface, myself I think they're over-kill. Remember: if you put in two totally different interfaces, you're going to have to document both of them.
|
---|