/
Destructor.pm
45 lines (30 loc) · 866 Bytes
/
Destructor.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package MouseX::Foreign::Meta::Role::Method::Destructor;
use Mouse::Role;
around _generate_destructor => sub {
my($next, undef, $meta) = @_;
my $foreign_superclass = $meta->foreign_superclass;
my $super_destroy;
if(!$foreign_superclass->can('DEMOLISHALL')){
$super_destroy = $foreign_superclass->can('DESTROY');
}
return sub {
my($self) = @_;
$self->DEMOLISHALL();
if(defined $super_destroy) {
$self->$super_destroy();
}
return;
};
};
no Mouse::Role;
1;
__END__
=head1 NAME
MouseX::Foreign::Meta::Role::Method::Destructor - The MouseX::Foreign meta method destructor role
=head1 VERSION
This document describes MouseX::Foreign version 0.001.
=head1 DESCRIPTION
Thisr is the meta method destructor role for MouseX::Foreign.
=head1 SEE ALSO
L<MouseX::Foreign>
=cut