I wanted to use Test::MockObject but didn't feel like arguing with anyone to get it installed so I invented a quickie little way to make mock objects.
use Symbol 'gensym'; # Create a new object in a new class. gensym() isn't strictly required +. Anything that makes namespaces would be sufficient. This is just co +nvenient. my $obj = gensym; my $class = *$obj{NAME}; bless $obj, $class; # Install a method *{"$class\::a_method"} = sub { whatever };
In reply to Smallish mock objects by diotalevi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |