# Because Mouse::Util is loaded first in all the Mouse sub-modules,
# XS loader is placed here, not in Mouse.pm.
- our $VERSION = '0.40_02';
+ our $VERSION = '0.40_05';
- my $need_pp = !!$ENV{MOUSE_PUREPERL};
+ my $xs = !(exists $INC{'Mouse/PurePerl.pm'} || $ENV{MOUSE_PUREPERL});
- if(!$need_pp && !exists $INC{'Mouse/PurePerl.pm'}){
+ if($xs){
local $@;
# XXX: XSLoader tries to get the object path from caller's file name
# $hack_mouse_file fools its mechanism
(my $hack_mouse_file = __FILE__) =~ s/.Util//; # .../Mouse/Util.pm -> .../Mouse.pm
- $need_pp = !eval sprintf("#line %d %s\n", __LINE__, $hack_mouse_file) . q{
+ $xs = eval sprintf("#line %d %s\n", __LINE__, $hack_mouse_file) . q{
require XSLoader;
XSLoader::load('Mouse', $VERSION);
};
#warn $@ if $@;
}
- if($need_pp){
+ if(!$xs){
require 'Mouse/PurePerl.pm'; # we don't want to create its namespace
}
+
+ *_MOUSE_XS = sub(){ $xs };
}
*get_metaclass_by_name = \&Mouse::Meta::Module::get_metaclass_by_name;
*get_all_metaclass_instances = \&Mouse::Meta::Module::get_all_metaclass_instances;
*get_all_metaclass_names = \&Mouse::Meta::Module::get_all_metaclass_names;
+
+ # is-a predicates
+ generate_isa_predicate_for('Mouse::Meta::TypeConstraint' => 'is_a_type_constraint');
+ generate_isa_predicate_for('Mouse::Meta::Class' => 'is_a_metaclass');
+ generate_isa_predicate_for('Mouse::Meta::Role' => 'is_a_metarole');
}
+
# Moose::Util compatible utilities
sub find_meta{
}
BEGIN {
- my $impl;
+ my $get_linear_isa;
if ($] >= 5.009_005) {
require mro;
- $impl = \&mro::get_linear_isa;
+ $get_linear_isa = \&mro::get_linear_isa;
} else {
my $e = do {
local $@;
$@;
};
if (!$e) {
- $impl = \&mro::get_linear_isa;
+ $get_linear_isa = \&mro::get_linear_isa;
} else {
# VVVVV CODE TAKEN FROM MRO::COMPAT VVVVV
my $_get_linear_isa_dfs; # this recurses so it isn't pretty
return \@lin;
};
# ^^^^^ CODE TAKEN FROM MRO::COMPAT ^^^^^
- $impl = $_get_linear_isa_dfs;
+ $get_linear_isa = $_get_linear_isa_dfs;
}
}
no warnings 'once';
- *get_linear_isa = $impl;
+ *get_linear_isa = $get_linear_isa;
}
my $role_name = $roles[-1][0];
load_class($role_name);
- Mouse::Util::TypeConstraints::_is_a_metarole( get_metaclass_by_name($role_name) )
+ is_a_metarole( get_metaclass_by_name($role_name) )
|| $applicant->meta->throw_error("You can only consume roles, $role_name(".$role_name->meta.") is not a Mouse role");
}
=head1 VERSION
-This document describes Mouse version 0.40_02
+This document describes Mouse version 0.40_05
=head1 IMPLEMENTATIONS FOR