I'm experimenting with Object::Tiny which seems useful and is lightweight for very simple objects. I'd like to make it a little more useful by being able to set properties:
$file->headers(\@headers);
This doesn't work. So I'm thinking of writing a set method:
sub set { my $s = shift; my $attribute = shift; my $value = shift; $s->{$attribute} = $value; }
But maybe this is horrible in a number of ways and I should use a slightly heavier module for creating objects?
In reply to Setting accessor with Object::Tiny by nysus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |