in reply to Using the strict module in object oriented programming

I use array objects with constants for the indexes, so I don't have that problem.
use constant FIRST_IDX => __PACKAGE__->SUPER::NEXT_IDX(); use constant IDX_NAME => FIRST_IDX + 0; use constant IDX_ATTS => FIRST_IDX + 1; use constant NEXT_IDX => FIRST_IDX + 2; sub name { my ($self) = @_; return $self->[IDX_NAME]; }

Something similar could be used for hashes.

use constant IDX_NAME => 'NAME'; use constant IDX_ATTS => 'ATTS'; sub name { my ($self) = @_; return $self->{IDX_NAME()}; }

As long as you always put the (), errors will always be caught (at run-time). A typo would lead to an error message like Undefined subroutine &main::IDX_NAMES called