Yes, this is one of the standard complaints with the usual method of creating objects in Perl. I can think of two options for you, but both of them are quite a lot of work.
Firstly, you could stop using the hash contents directly and only access your objects' attributes with accessor methods. You can even do this for object access within the class itself.
Secondly you can take a look at Inside-Out Objects. This is a new way of building objects in Perl. It's becoming quite popular and it specifically addresses your problem.
Update: Changed reference to something a bit more recent. But see also the references in xdg's post below.
"The first rule of Perl club is you do not talk about
Perl club."
-- Chip Salzenberg
In reply to Re: Using the strict module in object oriented programming
by davorg
in thread Using the strict module in object oriented programming
by mrguy123
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |