From: gfx Date: Sat, 28 Nov 2009 01:21:50 +0000 (+0900) Subject: Fix add_method to accept overloaded CODE references correctly X-Git-Tag: 0.40_09~25 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=24d5564d35368c23c59724fdfa05d9425748bfa0;p=gitmo%2FMouse.git Fix add_method to accept overloaded CODE references correctly --- diff --git a/xs-src/Mouse.xs b/xs-src/Mouse.xs index 5fca14f..8cab310 100644 --- a/xs-src/Mouse.xs +++ b/xs-src/Mouse.xs @@ -403,8 +403,8 @@ CODE: SV* sv = code_ref; /* used in tryAMAGICunDEREF */ SV** sp = &sv; /* used in tryAMAGICunDEREF */ tryAMAGICunDEREF(to_cv); /* try \&{$code} */ - if(SvROK(sv) && SvTYPE(SvRV(sv)) == SVt_PVCV){ - mouse_throw_error(self, NULL, "Not a CODE reference"); + if(!(SvROK(sv) && SvTYPE(SvRV(sv)) == SVt_PVCV)){ + mouse_throw_error(self, NULL, "You must pass a CODE reference to add_method"); } code_ref = sv; }