Re: ![PATCH] Moose::Util
[email protected] (John Napiorkowski)
| Newsgroups | perl.moose |
|---|---|
| Message-ID | <[email protected]> |
--- On Fri, 10/24/08, Ovid <[email protected]> wrote: > From: Ovid <[email protected]> > Subject: ![PATCH] Moose::Util > To: [email protected] > Date: Friday, October 24, 2008, 8:50 AM > Hi folks, > > I didn't attach a patch for Moose::Util. I pasted it. > That's because you shouldn't apply it, but we (BBC) > have to as a temporary fix until we can understand exactly > what's going on and how to better fix this. > > Basically, the patch changes > &Moose::Util::resolve_metaclass_alias to actually use > *our* metaclass name if it contains the string > 'Pips3'. This more than *doubles* the speed of our > test suite. However, 'Pips3' probably isn't > terribly useful for most folks :) Is the problem that Moose is underperforming for you, or is there a test case we can try to make it fail? > > We tried to do this: > > if ($metaclass_name !~ /^Moose/) { > > But our test suite fell down and went BOOM! I'll have to let someone else comment on this, but I would imagine somehow this is always getting called. Problem not worth trying to debug this bit. > > This is deeply mysterious to us, so if anyone can offer > insight into this, we'd be grateful. > > Cheers, > Ovid > -- > Buy the book - > http://www.oreilly.com/catalog/perlhks/ > Tech blog - http://use.perl.org/~Ovid/journal/ > Twitter - http://twitter.com/OvidPerl > Official Perl 6 Wiki - http://www.perlfoundation.org/perl6 > > =================================================================== > --- Util.pm (revision 11775) > +++ Util.pm (working copy) > @@ -126,9 +126,17 @@ > sub resolve_metaclass_alias { > my ( $type, $metaclass_name, %options ) = @_; > > + > + > if ( my $resolved = eval { > - my $possible_full_name = 'Moose::Meta::' . > $type . '::Custom::' . ( $options{trait} ? > "Trait::" : "" ) . $metaclass_name; > + my $possible_full_name; > > + if ($metaclass_name =~ /Pips3/) { > + $possible_full_name = $metaclass_name; > + } else { > + > + $possible_full_name = 'Moose::Meta::' . > $type . '::Custom::' . ( $options{trait} ? > "Trait::" : "" ) . $metaclass_name; > + } > Class::MOP::load_class($possible_full_name); > > > $possible_full_name->can('register_implementation')