nysus has asked for the wisdom of the Perl Monks concerning the following question:
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?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Setting accessor with Object::Tiny
by haukex (Archbishop) on Aug 11, 2019 at 20:21 UTC | |
|
Re: Setting accessor with Object::Tiny
by NetWallah (Canon) on Aug 11, 2019 at 21:26 UTC | |
|
Re: Setting accessor with Object::Tiny
by karlgoethebier (Abbot) on Aug 12, 2019 at 09:21 UTC | |
|
Re: Setting accessor with Object::Tiny
by jcb (Parson) on Aug 12, 2019 at 03:03 UTC | |
by AnomalousMonk (Archbishop) on Aug 12, 2019 at 05:03 UTC | |
by jcb (Parson) on Aug 12, 2019 at 05:10 UTC | |
by AnomalousMonk (Archbishop) on Aug 12, 2019 at 05:31 UTC | |
by jcb (Parson) on Aug 12, 2019 at 06:23 UTC | |
|
Re: Setting accessor with Object::Tiny
by 1nickt (Canon) on Aug 12, 2019 at 15:15 UTC |