6 Moose::Cookbook::Recipe6 - The Moose::Role example
18 my ($self, $other) = @_;
19 not $self->equal_to($other);
32 my ($self, $other) = @_;
33 $self->compare($other) == 0;
37 my ($self, $other) = @_;
38 $self->compare($other) == 1;
42 my ($self, $other) = @_;
43 $self->compare($other) == -1;
46 sub greater_than_or_equal_to {
47 my ($self, $other) = @_;
48 $self->greater_than($other) || $self->equal_to($other);
51 sub less_than_or_equal_to {
52 my ($self, $other) = @_;
53 $self->less_than($other) || $self->equal_to($other);
68 with 'Comparable', 'Printable';
70 has 'amount' => (is => 'rw', isa => 'Num', default => 0);
73 my ($self, $other) = @_;
74 $self->amount <=> $other->amount;
79 sprintf '$%0.2f USD' => $self->amount
88 Stevan Little E<lt>stevan@iinteractive.comE<gt>
90 =head1 COPYRIGHT AND LICENSE
92 Copyright 2006 by Infinity Interactive, Inc.
94 L<http://www.iinteractive.com>
96 This library is free software; you can redistribute it and/or modify
97 it under the same terms as Perl itself.