Bubblegum::Class - Object Orientation for Bubblegum via Moo
version 0.25
package BankAccount; use Bubblegum::Class; has balance => ( is => 'rw', default => 0 ); sub withdrawal { my $self = shift; my $amount = $self->balance - shift // 0; return $self->balance($amount); }
And elsewhere:
my $account = BankAccount->new(balance => 100000); say $account->withdrawal(1500);
Bubblegum::Class provides object orientation for your classes by way of Moo and activates all of the options enabled by the Bubblegum module. Using this module allows you to define classes as if you were using Moo directly.
use Bubblegum::Class;
is equivalent to
use 5.10.0; use strict; use autobox; use autodie ':all'; use feature ':5.10'; use warnings FATAL => 'all'; use English -no_match_vars; use utf8::all; use mro 'c3'; use Moo;
Al Newkirk <anewkirk@ana.io>
This software is copyright (c) 2013 by Al Newkirk.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Bubblegum, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Bubblegum
CPAN shell
perl -MCPAN -e shell install Bubblegum
For more information on module installation, please visit the detailed CPAN module installation guide.