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
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
Moose Notes (Score:2)
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:
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
Re: (Score:2)
Eek, roles behaviour differently depending on whether you do them separately or together?
Yet another reason to be annoyed :(
Re: (Score:2)
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.
Re:Moose Notes (Score:2)
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.
Reply to This
Parent
Re: (Score:1)
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
withand then applies that role to the class.The second way is to have multiple
wRe: (Score:2)
No, this does NOT count as "heavy".