3 use List::Util qw( sum );
10 trigger => sub { shift->_record_balance(@_) },
22 isa => 'ArrayRef[Int]',
23 default => sub { [] },
24 handles => { add_history => 'push' },
31 $self->balance( $self->balance + $amount );
38 die "Balance cannot be negative"
39 if $self->balance < $amount;
41 $self->balance( $self->balance - $amount );
50 my $old_value = shift;
52 $self->add_history($old_value);
57 __PACKAGE__->meta->make_immutable;