![PATCH] Moose::Util
[email protected] (Ovid)
| Newsgroups | perl.moose |
|---|---|
| Message-ID | <[email protected]> |
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 :)
We tried to do this:
if ($metaclass_name !~ /^Moose/) {
But our test suite fell down and went BOOM!
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')