Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Ovid (2709)

  (email not shown publicly)
AOL IM: ovidperl (Add Buddy, Send Message)

Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.

Journal of Ovid (2709)

Thursday April 30, 2009
04:47 AM

Oops, It Did It Again (Moose)

[ #38894 ]

So Child inherits from Parent. Parent used some roles but, unbeknownst to me, Parent implemented some methods the roles provided, effectively hiding them. Naturally, since this is silent, I had no idea this was happening. Yesterday, in preparing to eliminate this base class, I moved those roles to the classes which actually use them. Role composition failed and I blew another large chunk of time trying to figure out what happened. It was a perfect storm of several bits of code working together in exactly the way they needed to in order to sidestep a bug. Blind luck that it had worked previously.

Fortunately, it turns out that the hidden methods were effectively no-ops and this lack of activity was hidden by our class hierarchy and simply deleting them was enough to get the code working. Otherwise, I was facing a long battle trying to figure out the right thing to do. This little time bomb has been silently hiding under the covers for a few months now.

The moral of this story: if you must use inheritance, push your roles into your concrete classes, if possible, to gain the benefits of composition conflict checks.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.