Bubblegum
view release on metacpan or search on metacpan
lib/Bubblegum/Role.pm view on Meta::CPAN
# ABSTRACT: Class Component System for Bubblegum via Moo::Role
package Bubblegum::Role;
use 5.10.0;
use namespace::autoclean;
use Moo 'with';
with 'Bubblegum::Role::Configuration';
our $VERSION = '0.45'; # VERSION
sub import {
my $target = caller;
my $class = shift;
my @export = @_;
$class->prerequisites($target);
Moo::Role->import::into($target, @export);
}
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
Bubblegum::Role - Class Component System for Bubblegum via Moo::Role
=head1 VERSION
version 0.45
=head1 SYNOPSIS
package CheckingService;
use Bubblegum::Role;
sub deposit {
my $self = shift;
my $amount = $self->balance + shift // 0;
return $self->balance($amount);
}
sub withdrawal {
my $self = shift;
my $amount = $self->balance - shift // 0;
return $self->balance($amount);
}
package BankAccount;
use Bubblegum::Class;
with 'CheckingService';
has balance => (
is => 'rw',
default => 0
);
( run in 2.569 seconds using v1.01-cache-2.11-cpan-a49fcb8fa48 )