in reply to Setting accessor with Object::Tiny

Hi, I'd say it's too "lightweight" if you have to start hacking it :-)

I second haukex and recommend Moo for all OOP work, even for one-liners.

$ perl -wE 'package Foo { use Moo; has bar => (is => "rw", isa => sub +{ die "invalid" unless shift =~ /^[a-z]+$/ }) }; my $o = Foo->new(bar + => "baz"); $o->bar("qux"); say $o->bar; $o->bar(42)' qux isa check for "bar" failed: invalid at -e line 1.

Hope this helps!


The way forward always starts with a minimal test.