NAME Music::Note::Role::Operators DESCRIPTION Role::Tiny to be applied on top Music::Note with comparison methods added and overloaded operators. Also adds a clone method. SYNOPSIS If you're working with a Music::Note subclass: package Music::MyNote; use parent 'Music::Note'; use Role::Tiny::With; with 'Music::Note::Role::Operators'; # etc Or if you're working in a script and just want the behaviour: use Music::Note; use Role::Tiny (); # Don't import R::T into current namespace for cleanliness Role::Tiny->apply_roles_to_package('Music::Note', 'Music::Note::Role::Operators'); SUMMARY Assuming you're working in a script: my $note = Music::Note->new('C#'); my $other = Music::Note->new('E'); my $true = $other->gt($note); $true = $other > $note; $true = $note->lt($other); $true = $note < $other; $true = $note->eq($note->clone); $true = $note == $note->clone; $true = $note->gte($note->clone); $true = $note >= $note->clone; $true = $note->lte($note->clone); $true = $note <= $note->clone; CAVEAT Don't try to do something like $note == 90>. The overloading expects a Music::Note on both sides. To perform comparisons versus note and not a note you should be doing $note->format('midi') == 90. AUTHOR Kieren Diment zarquon@cpan.org LICENSE This code can be redistributed on the same terms as perl itself