On Mon, Nov 02, 2009 at 08:34:55PM -0600, Elliot Shank wrote: > I'm attempting to allow an attribute trait's attributes (meta meta meta) to > be overridden via the "has '+foo' ..." form, but this doesn't seem to work. > It doesn't look like my "around" of > Moose::Meta::Attribute::legal_options_for_inheritance() is being invoked. > > What am I doing wrong? I'm guessing that it has something to do with the > role attribute not having the trait, but, of course, that's one of the things > I'm trying to do here.
Yeah... the issue here is that when you use the +foo syntax, it does the checking of legal options before it actually looks at what those options are, meaning that modifying the legal options in a trait that's applied by the overridden attribute happens too late. I'm not quite sure what a reasonable fix would be though, since the check is concetually a part of the parent attribute, telling the things inherited from it what they're allowed to override. The check happens before the inherited attribute is even created, since the point of it is to avoid passing illegal options to the constructor. Maybe this is another point in favor of dropping the whole "legal options" concept in general? -doy