2 # as discussed on irc between ether and t0m
3 # <@ether> t0m: it's known. I asked doy about this a day or two ago as well
4 # <@ether> the problem is that the requires() is evaluated immediately, but
5 # the attributes are not added until the final composition into
7 # <@ether> I suppose the solution would be to compose the attributes into
8 # the "thing" that results from TesT::Role::ProvidesThing
9 # composing RequiresThing, rather than it being delayed until the
10 # final composition, but I suspect that requires a lot of heavy
12 # <@ether> it's frustrating because it pretty much means you can't put a
13 # 'requires' statement in anything but a class
14 # <@ether> so you can't compose a role built from other roles in order to
15 # build an interface, and guarantee that interface was built
16 # correctly with the requires() assertions
21 use Test::More tests => 2;
26 package Test::Role::RequiresThing;
32 package Test::Role::ProvidesThing;
35 has thing => ( is => 'ro' );
37 with 'Test::Role::RequiresThing';
44 lives_ok { with 'Test::Role::ProvidesThing' } 'can compose role that imposes a requirement that a composed role satisfies';