I found it interesting that this let me easily move around which helper class or which of a set of collaborating classes actually implemented the thing.
B and C contain references to the A parent, and the 'has' 'handles' construct can specify to delegate all the functions that A is providing.
Likewise, the variable in A that holds its B also delegates functions that B implements.
Methods in either class can just refer to functions in the overall complex, and not care which object is handling it. If you move a function, you change the 'has' lines but no other code!
This is inside what you are calling B:
Both of those are pointing back to A. But I could further break up A and make the tag formatter into yet another separate class later!has tag_formatter => ( is => 'ro', handles => [ qw( format_tag escape filter link_prefixes)], required => 1, weak_ref => 1, # normally points back to parent Creole object ); has config_keeper => ( is => 'ro', handles => [ qw( placeholder_callback link_mapper image_mapper)], required => 1, weak_ref => 1, # normally points back to parent Creole object );
—John
In reply to Re: Moose design question
by John M. Dlugosz
in thread Moose design question
by elTriberium
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |