sub resolve_metaclass_alias {
my ( $type, $metaclass_name, %options ) = @_;
- my $cache_key = $type . q{ } . ( $options{trait} ? '-Trait' : '' );
+ my @trait = $options{trait} ? ('Trait') : ();
+ my $cache_key = join '-',
+ $type, @trait, $metaclass_name;
- return $cache{$cache_key}{$metaclass_name} ||= do{
+ return $cache{$cache_key} ||= do{
my $possible_full_name = join '::',
- 'Mouse::Meta', $type, 'Custom', ($options{trait} ? 'Trait' : ()), $metaclass_name
+ 'Mouse::Meta', $type, 'Custom', @trait, $metaclass_name
;
my $loaded_class = load_first_existing_class(
# Basis of Data::OptList
my $max = scalar(@_);
for (my $i = 0; $i < $max ; $i++) {
+ my $role_name = $_[$i];
+
if ($i + 1 < $max && ref($_[$i + 1])) {
- push @roles, [ $_[$i] => $_[++$i] ];
+ push @roles, [ $role_name=> $_[++$i] ];
} else {
- push @roles, [ $_[$i] => undef ];
+ push @roles, [ $role_name => undef ];
}
- my $role_name = $roles[-1][0];
load_class($role_name);
is_a_metarole( get_metaclass_by_name($role_name) )