The handles => ['teach'] bit is really just a shortcut for writing something like:
sub teach { (shift->teacher or die)->teach(@_); }
It's not especially sophisticated - e.g. it doesn't make can("teach") return false if teacher is not set. But it's a useful technique for observing the Law of Demeter.
In reply to Re^3: Remove roles for an object in perl moose
by tobyink
in thread Remove roles for an object in perl moose
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |