package Foo; sub new { my $class = shift; my $self = { foo => 'bar', baz => 'qux', }; return bless $self, $class; } # 'private' method sub _get_foo { my $self = shift; return $self->{foo}; } # 'public' method sub get_foo { my $self = shift; return $self->_get_foo(); } #### # 'private' has to change sub _get_foo { my $self = shift; return $self->{bar}; } # but 'public' doesn't sub get_foo { my $self = shift; return $self->_get_foo(); } #### sub get_foo { my $self = shift; carp "get_foo() is deprecated, use get_bar()"; return _get_bar(); } sub get_bar { my $self = shift; return $self->_get_bar(); }