# New Ticket Created by "Alek Storm" # Please include the string: [perl #42548] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=42548 >
The following code demonstrates the reversed output of Object.can(): .sub main :main $P0 = new 'Hash' $P1 = new 'Class', $P0 $P2 = find_global 'bar' $P1.'add_method'('bar', $P2) $P3 = $P1.'new'() $I0 = can $P3, 'bar' $I1 = can $P3, 'baz' print $I0 print $I1 print "\n" .end .sub 'bar' :method print "bar\n" .end I've attached a patch to fix this. -- Alek Storm
Index: src/pmc/object.pmc =================================================================== --- src/pmc/object.pmc (revision 18231) +++ src/pmc/object.pmc (working copy) @@ -184,7 +184,7 @@ { /* Just use find_method and see it if finds anything. */ PMC *method = VTABLE_find_method(interp, SELF, method_name); - return PMC_IS_NULL(method); + return !PMC_IS_NULL(method); } }