Subject: | Fake isa() method |
Hello again,
one of my coworkers has put a
$redis->isa('Redis') or die;
check into his module's constructor so I had to work around it. I think
it would be a nice feature to pretend we're Redis in cases like this
(however, what about Redis::hiredis, etc, do the yall fake isa?)
Here's my patch in case it's really worth it (though I'll attach a
better version later today).
diff -ur /usr/local/lib/perl5/site_perl/5.10.1/Test/Mock/Redis.pm
/www/lib/Test/Mock/Redis.pm
--- /usr/local/lib/perl5/site_perl/5.10.1/Test/Mock/Redis.pm 2011-07-14
11:20:41.000000000 +0400
+++ /www/lib/Test/Mock/Redis.pm 2012-01-31 13:04:59.000000000 +0400
@@ -1059,6 +1059,11 @@
=cut
+sub isa {
+ my ($self, $class) = @_;
+ return 1 if $class eq 'Redis';
+ return $self->SUPER::isa($class);
+};
sub _is_list {
my ( $self, $key ) = @_;