Stories
Slash Boxes
Comments
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.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • I wasn't aware that the extends needs to be in a BEGIN block unless you really do have code which needs to happen at BEGIN time. Am I wrong? (Could be).

    Also, with accepts a list and using multiple with statements should be avoided unless you have a very, very good reason to do so. A single with statement is like this:

    with qw(Does::Role1 DoesRole2);

    Using it like that gets you the method conflict resolution. Using separate with statements is not only overly verbose, but it composes each role in separate

    • Eek, roles behaviour differently depending on whether you do them separately or together?

      Yet another reason to be annoyed :(

      • Eek, Perl's built-ins behave differently depending on whether or not you call them in scalar context? Yet another reason to be annoyed! ;)

        Seriously, it will take you about 3 seconds to get used to this behaviour of the with function and it's behaviour you want.

        If you must write an alternative to the Moose API, I strongly recommend that you use Moose for a few months to get really comfortable with it and make sure you understand the design implications. Moose is great and well worth the learning curve.

        • It's not a case of getting used to it.

          It's that it's a gotcha that the API should never have allowed.

          And our team HAS been using Moose for several months. MooseX::Atom is the summary of all the bits of it we don't like.

          • Eek, roles behaviour differently depending on whether you do them separately or together?
            It's that it's a gotcha that the API should never have allowed.

            Actually there are very good reasons why there are two ways to compose roles.

            The ideal way to compose roles is to do it all at once like Ovid showed. This takes better advantage of conflict checking because it first creates a composite role of all the roles passed to with and then applies that role to the class.

            The second way is to have multiple w