#! /usr/local/bin/perl package Product::Driver; use strict; use warnings; use Moose; has counter => ( isa => 'Int', default => 0, reader => 'value' ); sub add_one { my ( $self ) = @_; return ++$self->{'counter'}; } sub subtract_one { my ( $self ) = @_; return --$self->{'counter'}; } sub add_number { my ( $self, $amount ) = @_; return $self->{'counter'} += $amount; } sub subtract_number { my ( $self, $amount ) = @_; return $self->{'counter'} -= $amount; } sub reset_counter { my ( $self ) = @_; return $self->{'counter'} = 0; } 1;