in reply to Link methods to hash values
Why not simply provide a 'get' method?
$self->get ('name'); ... sub get { my ($self, $param) = @_; return undef if ! exists $self->{$param}; return $self->{$param}; }
Alternatively there are CPAN modules such as Class::MethodMaker that will generate getters and setters for you given a list of properties.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Link methods to hash values
by chromatic (Archbishop) on Oct 01, 2006 at 23:30 UTC | |
|
Re^2: Link methods to hash values
by Herkum (Parson) on Oct 01, 2006 at 19:08 UTC | |
by friedo (Prior) on Oct 01, 2006 at 19:18 UTC | |
by Herkum (Parson) on Oct 01, 2006 at 20:53 UTC | |
by tinita (Parson) on Oct 02, 2006 at 08:03 UTC |