Created
June 9, 2009 22:24
-
-
Save draegtun/126849 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use MooseX::Declare; | |
role DoesNegated { | |
method negated { $self->new( x => -$self->x, y => -$self->y ) } | |
} | |
role DoesTranspose { | |
method transpose { $self->new( x => $self->y, y => $self->x ) } | |
} | |
class Point with DoesNegated with DoesTranspose { | |
has x => ( isa => 'Int', is => 'rw' ); | |
has y => ( isa => 'Int', is => 'rw' ); | |
method inspect { say $self->x . ' @ ' . $self->y } | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment