Subclassing Badger::Base

package Your::Point;
use base 'Badger::Base';

sub init {
    my ($self, $config) = @_;
    $self->{ x } = $config->{ x };
    $self->{ y } = $config->{ y };
    return $self;

sub x { $_[0]->{ x } }
sub y { $_[0]->{ y } }
Thus Spake Andy:

If you've ever used Class::Base (or Template::Base) then you'll know the score here. You typically inherit the new() method and write your own init() method. This separates object construction from object initialisation and is usually considered to be a Good Thing™.

The example shows a simple point class for storing an x and y values. The init() method simply copies the values from the configuration parameters into $self. We also provide a couple of (ugly, but fast) accessor methods just to show what they look like when raw.