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

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.
  • I looked around on CPAN for what the state of the art in mixing is...

    The state of the art of mixins in Perl 5 is Class::Trait [].

  • So you want to mixin your bomb class and your girlfriend class to your current class:

    package Bomb;

    sub fuse    { ... }
    sub explode { ... }

    package Girlfriend;

    sub fuse    { ... }
    sub explode { ... }

    What happens when you want the Bomb::fuse method (because you can control the timing) but you also want the Girlfriend::explode method (because it's presumably non-lethal)? Now you have an ordering problem and you can't eliminate it. Of course, you could just use delegation, but that does

  • I do most of my mixing in of methods with Sub::Exporter [].

    I end up not often needing the override-and-super feature that I see as being the real benefit of -- but Sub::Exporter::Util::mixin_exporter can do that if I need it.
  • Assuming that your diamondy inheritance heirarchy is somewhat sane, the most common problems that cause a hierarchy to be invalid are re-ordering of dependencies, which is relatively easy to spot and fix. Example: package A; our @ISA = qw/B C/; package B; our @ISA = qw/D E/; package C; our @ISA = qw/E D/; Because A inherits from B+C, and they each inherit D+E in a different order, C3 cannot resolve this. The fix is to use D+E in the same order in both places. Most issues converting legacy hierarchies

    • "Assuming that your diamondy inheritance heirarchy is somewhat sane"

      I think I see the problem.