6 Moose::Cookbook::Recipe6 - The Moose::Role example
16 my ($self, $other) = @_;
17 not $self->equal_to($other);
28 my ($self, $other) = @_;
29 $self->compare($other) == 0;
33 my ($self, $other) = @_;
34 $self->compare($other) == 1;
38 my ($self, $other) = @_;
39 $self->compare($other) == -1;
42 sub greater_than_or_equal_to {
43 my ($self, $other) = @_;
44 $self->greater_than($other) || $self->equal_to($other);
47 sub less_than_or_equal_to {
48 my ($self, $other) = @_;
49 $self->less_than($other) || $self->equal_to($other);
60 with 'Comparable', 'Printable';
62 has 'amount' => (is => 'rw', isa => 'Num', default => 0);
65 my ($self, $other) = @_;
66 $self->amount <=> $other->amount;
71 sprintf '$%0.2f USD' => $self->amount
80 Stevan Little E<lt>stevan@iinteractive.comE<gt>
82 =head1 COPYRIGHT AND LICENSE
84 Copyright 2006 by Infinity Interactive, Inc.
86 L<http://www.iinteractive.com>
88 This library is free software; you can redistribute it and/or modify
89 it under the same terms as Perl itself.