stevan / p5-mop-redux

A(nother) MOP for Perl 5
139 stars 36 forks source link

Methods with empty bodies returning their invocant #148

Closed Ovid closed 10 years ago

Ovid commented 10 years ago
use 5.018;                                                                                                                                                                                                    
use mop;

class Foo {
    method empty_method {}
}

say Foo->new->empty_method;

That prints something like Foo=SCALAR(0x7fe66289f4f0). I need to put an empty return() in the method body to prevent it. For a standard Perl class (or Moose class) a sub with an empty body doesn't return anything.

stevan commented 10 years ago

Ah, this is a regression actually, this was a problem very early on and was fixed, but must have crept back in with the XS-ification work that @doy and @rafl did.

Would you mind writing up a quick test for this?