Another possibility (somewhat cleaner from an OOPy perspective :) would be to define accessors that return a reference to the hash:
sub new { my $class = shift; $class = ref $class || $class; my $self = {}; $self->{_smtp} = {}; bless $self, $class; } sub smtp { my $self = shift; return $self->{_smtp} }
Then you can use $node->smtp->{status} or what not to access items. You can even get fancy and let the accessor return slices and what not. C.f. also the Class::MethodMaker module which will write this kind of thing for you.
In reply to Re: hash as an object property
by Fletch
in thread hash as an object property
by dhammaBum
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |