Challenge 3: A Role — Possible Solution ==================================================================== package Describable; use Moo::Role; sub summary { my $self = shift; return "This is a " . ref($self); } package Widget; use Moo; with 'Describable'; package main; use strict; use warnings; use feature 'say'; my $widget = Widget->new(); say $widget->summary(); Output: This is a Widget WHY THIS WORKS AS AN ANSWER ------------------------------ package Describable; use Moo::Role; reuses the chapter's own role- declaration syntax exactly — Moo::Role (not plain Moo) is what marks this package as a role rather than an ordinary class, per the chapter's own note that a role "has no 'new', meant to be composed in" rather than instantiated directly. sub summary reuses the standard shift-self-first method pattern from Chapter 3, still fully applicable here since a role's methods work exactly like a class's own methods once composed in. ref($self) returns the actual class name of whatever object summary() is called on — here "Widget" — which is what lets this same role produce a correct answer regardless of which class eventually composes it in, rather than hardcoding "Widget" directly into the role itself. package Widget; use Moo; with 'Describable'; reuses the chapter's own composition syntax exactly — with 'Describable'; pulls summary() directly into Widget, genuinely different from extends (Chapter 4's own inheritance mechanism) since Widget never declares an @ISA-style parent relationship to Describable at all, matching the chapter's own description of roles as composed in, not inherited from. $widget->summary() then calls the composed-in method exactly as if it had been written directly inside Widget itself, correctly printing "This is a Widget".