my $can_be_required = defined( $args->{init_arg} );
if(exists $args->{builder}){
+ # XXX:
+ # Moose refuses a CODE ref builder, but Mouse doesn't for backward compatibility
+ # This feature will be changed in a future. (gfx)
$class->throw_error('builder must be a defined scalar value which is a method name')
- if ref $args->{builder} || !(defined $args->{builder});
+ #if ref $args->{builder} || !defined $args->{builder};
+ if !defined $args->{builder};
$can_be_required++;
}
use strict;
use warnings;
-use Mouse::Util qw(:meta not_supported english_list);
+use Mouse::Util qw(:meta not_supported english_list get_code_info);
use Mouse::Meta::Module;
our @ISA = qw(Mouse::Meta::Module);
sub method_metaclass(){ 'Mouse::Meta::Role::Method' } # required for get_method()
+# XXX: for backward compatibility
+my %foreign = map{ $_ => undef } qw(Mouse::Role Carp Scalar::Util UNIVERSAL);
+sub _code_is_mine{
+ my($self, $code) = @_;
+
+ my($package, $name) = get_code_info($code);
+
+ return $package && !exists $foreign{$package};
+}
+
+
sub _construct_meta {
my $class = shift;