{
package Role::Foo;
- use strict;
- use warnings;
use Moose::Role;
requires 'foo';
sub bar { 'Role::Foo::bar' }
package Role::Bar;
- use strict;
- use warnings;
use Moose::Role;
requires 'bar';
{
package My::Test1;
- use strict;
- use warnings;
use Moose;
::lives_ok {
} '... our mutually recursive roles combine okay';
package My::Test2;
- use strict;
- use warnings;
use Moose;
::lives_ok {
{
package Role::Bling;
- use strict;
- use warnings;
use Moose::Role;
sub bling { 'Role::Bling::bling' }
package Role::Bling::Bling;
- use strict;
- use warnings;
use Moose::Role;
sub bling { 'Role::Bling::Bling::bling' }
{
package My::Test3;
- use strict;
- use warnings;
use Moose;
::throws_ok {
} qr/requires the method \'bling\' to be implemented/, '... role methods conflicted and method was required';
package My::Test4;
- use strict;
- use warnings;
use Moose;
::lives_ok {
} '... role methods didnt conflict when manually combined';
package My::Test5;
- use strict;
- use warnings;
use Moose;
::lives_ok {
} '... role methods didnt conflict when manually combined (in opposite order)';
package My::Test6;
- use strict;
- use warnings;
use Moose;
::lives_ok {
{
package Role::Bling::Bling::Bling;
- use strict;
- use warnings;
use Moose::Role;
with 'Role::Bling::Bling';
{
package Role::Boo;
- use strict;
- use warnings;
use Moose::Role;
has 'ghost' => (is => 'ro', default => 'Role::Boo::ghost');
package Role::Boo::Hoo;
- use strict;
- use warnings;
use Moose::Role;
has 'ghost' => (is => 'ro', default => 'Role::Boo::Hoo::ghost');
{
package My::Test7;
- use strict;
- use warnings;
use Moose;
::throws_ok {
'... role attrs conflicted and method was required';
package My::Test8;
- use strict;
- use warnings;
use Moose;
::lives_ok {
} '... role attrs didnt conflict when manually combined';
package My::Test9;
- use strict;
- use warnings;
use Moose;
::lives_ok {
} '... role attrs didnt conflict when manually combined';
package My::Test10;
- use strict;
- use warnings;
use Moose;
has 'ghost' => (is => 'ro', default => 'My::Test10::ghost');
{
package Role::Plot;
- use strict;
- use warnings;
use Moose::Role;
override 'twist' => sub {
};
package Role::Truth;
- use strict;
- use warnings;
use Moose::Role;
override 'twist' => sub {
{
package My::Test::Base;
- use strict;
- use warnings;
use Moose;
sub twist { 'My::Test::Base::twist' }
package My::Test11;
- use strict;
- use warnings;
use Moose;
extends 'My::Test::Base';
} '... composed the role with override okay';
package My::Test12;
- use strict;
- use warnings;
use Moose;
extends 'My::Test::Base';
} '... composed the role with override okay';
package My::Test13;
- use strict;
- use warnings;
use Moose;
::dies_ok {
} '... cannot compose it because we have no superclass';
package My::Test14;
- use strict;
- use warnings;
use Moose;
extends 'My::Test::Base';
{
package Role::Reality;
- use strict;
- use warnings;
use Moose::Role;
::throws_ok {