Adding Error Handling (Perl 5.10+)

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

sub init {
    my ($self, $config) = @_;

    $self->{ x } = $config->{ x }
        // $self->error("No value specified for x");

    $self->{ y } = $config->{ y }
        // $self->error("No value specified for y");

    return $self;
Thus Spake Andy:

The best laid plans of badgers and men go often astray. Badger::Base provides a simple error() which accepts one or more strings (just like print()) which it merges into a single error message and throws. This example uses Perl 5.10's fancy new "defined or" operator //.