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.
  • We're also assuming that the user of Role1 and Role2 has control over those roles.

    What if I want to use Role1 from AuthorA and Role2 from AuthorB, and both roles have an update() method?

    How do I resolve that? Even still, at least the problem will be up front.

    • If AuthorA and AuthorB are separate classes, just use the correct roles and exclude the methods you don't want. If they're separate instances, use runtime role application:

        unless $author_a->meta->does_role('Role1');
        unless $author_b->meta->does_role('Role2');

      That's a little ugly, but it's safer than not checking for the use of the role. If you know that the role(s) will only be applied at runtime once and only once, you can skip the does_role check.