Using Roles with Classes
package US::Currency;
use Moose;
with 'Comparable', 'Printable';
has 'amount' => (is => 'rw', isa => 'Num', default => 0);
sub compare {
my ($self, $other) = @_;
$self->amount <=> $other->amount;
}
...
| Møøse |
package US::Currency;
use Moose;
with 'Comparable', 'Printable';
has 'amount' => (is => 'rw', isa => 'Num', default => 0);
sub compare {
my ($self, $other) = @_;
$self->amount <=> $other->amount;
}
...
| Copyright © 2006 Stevan Little |