line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MouseX::Foreign::Meta::Role::Class; |
2
|
32
|
|
|
32
|
|
328652
|
use Mouse::Role; |
|
32
|
|
|
|
|
37361
|
|
|
32
|
|
|
|
|
19385
|
|
3
|
32
|
|
|
32
|
|
22243
|
use Mouse::Util::MetaRole; |
|
32
|
|
|
|
|
1854
|
|
|
32
|
|
|
|
|
14816
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
__PACKAGE__->meta->add_metaclass_accessor('foreign_superclass'); |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
after superclasses => sub { |
8
|
|
|
|
|
|
|
my($self, @args) = @_; |
9
|
|
|
|
|
|
|
if(@args && !$self->name->isa('Mouse::Object')) { |
10
|
|
|
|
|
|
|
push @{$self->{superclasses}}, 'Mouse::Object'; |
11
|
|
|
|
|
|
|
} |
12
|
|
|
|
|
|
|
return; |
13
|
|
|
|
|
|
|
}; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
before verify_superclass => sub { |
16
|
|
|
|
|
|
|
my($self, $super, $super_meta) = @_; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
if(defined($super_meta) && $super_meta->does(__PACKAGE__)) { |
19
|
|
|
|
|
|
|
$self->inherit_from_foreign_class($super); |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
return; |
22
|
|
|
|
|
|
|
}; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub inherit_from_foreign_class { # override |
25
|
43
|
|
|
43
|
0
|
1187
|
my($self, $super) = @_; |
26
|
43
|
100
|
|
|
|
495
|
if(defined $self->foreign_superclass) { |
27
|
2
|
|
|
|
|
22
|
$self->throw_error( |
28
|
|
|
|
|
|
|
"Multiple inheritance" |
29
|
|
|
|
|
|
|
. " from foreign classes ($super, " |
30
|
|
|
|
|
|
|
. $self->foreign_superclass |
31
|
|
|
|
|
|
|
. ") is forbidden"); |
32
|
|
|
|
|
|
|
} |
33
|
41
|
|
|
|
|
92
|
my %traits; |
34
|
41
|
50
|
|
|
|
264
|
if($super->can('new')) { |
35
|
41
|
|
|
|
|
166
|
$traits{constructor} = ['MouseX::Foreign::Meta::Role::Method::Constructor']; |
36
|
|
|
|
|
|
|
} |
37
|
41
|
100
|
|
|
|
318
|
if($super->can('DESTROY')) { |
38
|
4
|
|
|
|
|
14
|
$traits{destructor} = ['MouseX::Foreign::Meta::Role::Method::Destructor']; |
39
|
|
|
|
|
|
|
} |
40
|
41
|
50
|
|
|
|
168
|
if(%traits) { |
41
|
41
|
|
|
|
|
305
|
$self->foreign_superclass($super); |
42
|
41
|
|
|
|
|
261
|
$_[0] = $self = Mouse::Util::MetaRole::apply_metaroles( |
43
|
|
|
|
|
|
|
for => $self, |
44
|
|
|
|
|
|
|
class_metaroles => \%traits, |
45
|
|
|
|
|
|
|
); |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
# FIXME |
48
|
41
|
|
|
|
|
21281
|
$self->add_method( |
49
|
|
|
|
|
|
|
new => $self->constructor_class->_generate_constructor($self), |
50
|
|
|
|
|
|
|
); |
51
|
41
|
|
|
|
|
857
|
$self->add_method( |
52
|
|
|
|
|
|
|
DESTROY => $self->destructor_class->_generate_destructor($self), |
53
|
|
|
|
|
|
|
); |
54
|
|
|
|
|
|
|
} |
55
|
41
|
|
|
|
|
267
|
return; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
32
|
|
|
32
|
|
194
|
no Mouse::Role; |
|
32
|
|
|
|
|
69
|
|
|
32
|
|
|
|
|
186
|
|
59
|
|
|
|
|
|
|
1; |
60
|
|
|
|
|
|
|
__END__ |