in reply to Re^4: OO: how to make a generic sub (use roles or inheritance)
in thread OO: how to make a generic sub

This appears to be a bug. Your example works perfectly switching from Role::Tiny to Moose::Role. I'll ask around and update this node with what I find out.

Update: yes, it's a massive bug with a one line fix (an eight character fix, actually). I'm shocked and appalled that such a clear problem exists in Role-Tiny. I've pushed a test case and fix to the Role-Tiny repository, but don't have the necessary PAUSE permissions to release a quick fix to CPAN. I'll try to badger somebody who does into getting it released quickly.

Update (2.5 weeks later): Role::Tiny 1.003000 is out and fixes this issue.

package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name
  • Comment on Re^5: OO: how to make a generic sub (use roles or inheritance)