Skip Menu |
 

This queue is for tickets about the MooseX-MultiMethods CPAN distribution.

Report information
The Basics
Id: 131592
Status: new
Priority: 0/
Queue: MooseX-MultiMethods

People
Owner: Nobody in particular
Requestors: perl [...] toby.ink
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Doesn't support roles in any kind of useful way
Download (untitled) / with headers
text/plain 1.4k
use v5.12; use strict; use warnings; package Paper { use Moose; } package Scissors { use Moose; } package Rock { use Moose; } package Lizard { use Moose; } package Spock { use Moose; } package Game::Role::BaseCase { use Moose::Role; use MooseX::MultiMethods; multi method play (Any $x, Any $y) { 0 } } package Game::Role::StandardCombos { use Moose::Role; use MooseX::MultiMethods; multi method play (Paper $x, Rock $y) { 1 } multi method play (Scissors $x, Paper $y) { 1 } multi method play (Rock $x, Scissors $y) { 1 } } package Game::Role::ExtraCombos { use Moose::Role; use MooseX::MultiMethods; multi method play (Paper $x, Spock $y) { 1 } multi method play (Scissors $x, Lizard $y) { 1 } multi method play (Rock $x, Lizard $y) { 1 } multi method play (Lizard $x, Paper $y) { 1 } multi method play (Lizard $x, Spock $y) { 1 } multi method play (Spock $x, Rock $y) { 1 } multi method play (Spock $x, Scissors $y) { 1 } } package Game { use Moose; use MooseX::MultiMethods; with qw( Game::Role::BaseCase Game::Role::StandardCombos Game::Role::ExtraCombos ); } # Expected (or at least hoped!) outcome... my $game = Game->new; say $game->play(Paper->new, Rock->new); # 1, Paper covers Rock say $game->play(Spock->new, Paper->new); # 0, Paper disproves Spock say $game->play(Spock->new, Scissors->new); # 1, Spock smashes Scissors


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.