
=pod

=head1 NAME

Moose::Cookbook::Recipe6 - The Moose::Role example

=head1 SYNOPSIS
  
  package Eq;
  use strict;
  use warnings;
  use Moose::Role;
  
  requires 'equal_to';
  
  sub not_equal_to { 
      my ($self, $other) = @_;
      !$self->equal_to($other);
  }
  
  package Ord;
  use strict;
  use warnings;
  use Moose::Role;
  
  with 'Eq';
  
  requires 'compare';
  
  sub equal_to {
      my ($self, $other) = @_;
      $self->compare($other) == 0;
  }    
  
  sub greater_than {
      my ($self, $other) = @_;
      $self->compare($other) == 1;
  }    
  
  sub less_than {
      my ($self, $other) = @_;
      $self->compare($other) == -1;
  }
  
  sub greater_than_or_equal_to {
      my ($self, $other) = @_;
      $self->greater_than($other) || $self->equal_to($other);
  }        
  
  sub less_than_or_equal_to {
      my ($self, $other) = @_;
      $self->less_than($other) || $self->equal_to($other);
  }    
  
  package US::Currency;
  use strict;
  use warnings;
  use Moose;
  
  with 'Ord';
  
  has 'amount' => (is => 'rw', isa => 'Int', default => 0);
  
  sub compare {
      my ($self, $other) = @_;
      $self->amount <=> $other->amount;
  }
  
=head1 DESCRIPTION

Coming Soon. 

=head1 AUTHOR

Stevan Little E<lt>stevan@iinteractive.comE<gt>

=head1 COPYRIGHT AND LICENSE

Copyright 2006 by Infinity Interactive, Inc.

L<http://www.iinteractive.com>

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.

=cut       
       