# Retrieve object count sub get_count { $_count; } # Private count increment/decrement methods sub _incr_count { ++$_count } sub _decr_count { --$_count } } # Constructor may be called as a class method # (in which case it uses the calss's default values), # or an object method # (in which case it gets defaults from the existing object) sub new { my ($caller, %arg) = @_; my $caller_is_obj = ref($caller); my $class = $caller_is_obj || $caller; my $self = bless {}, $class;