projects
/
gitmo/Mouse.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
blame
|
history
|
raw
|
HEAD
Test that before/after/around live, and defining a sub within a role
[gitmo/Mouse.git]
/
lib
/
Mouse
/
Role.pm
1
#!/usr/bin/env perl
2
package Mouse::Role;
3
use strict;
4
use warnings;
5
6
use Sub::Exporter;
7
use Carp 'confess';
8
9
do {
10
my $CALLER;
11
12
my %exports = (
13
extends => sub {
14
return sub {
15
confess "Role does not currently support 'extends'";
16
}
17
},
18
before => sub {
19
return sub { }
20
},
21
after => sub {
22
return sub { }
23
},
24
around => sub {
25
return sub { }
26
},
27
);
28
29
my $exporter = Sub::Exporter::build_exporter({
30
exports => \%exports,
31
groups => { default => [':all'] },
32
});
33
34
sub import {
35
$CALLER = caller;
36
37
strict->import;
38
warnings->import;
39
40
goto $exporter;
41
}
42
43
sub unimport {
44
}
45
};
46
47
1;
48