That's something an attribute could very elegantly handle:
my %Mode : Field(rw); # generate accessor + mutator
my %Status : Field(ro); # generate only accessor
my %Connection : Field; # generate nothing
I'm also thinking it would be nice if one could also write
my %Mode : Field(rw custom);
which would not create an accessor, but would test for the existence of one and complain if it didn't find one. That way the code becomes self documenting. Maybe a do-nothing private attribute would be nice to that end as well.
Makeshifts last the longest. |