line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojo::Role; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# ABSTRACT: Mojo::Role - Tiny and simple role system for Mojo |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# imports |
6
|
2
|
|
|
2
|
|
30964
|
use Mojo::Base -strict; |
|
2
|
|
|
|
|
13552
|
|
|
2
|
|
|
|
|
10
|
|
7
|
2
|
|
|
2
|
|
1153
|
use Role::Tiny (); |
|
2
|
|
|
|
|
5196
|
|
|
2
|
|
|
|
|
35
|
|
8
|
2
|
|
|
2
|
|
761
|
use Role::Tiny::With (); |
|
2
|
|
|
|
|
379
|
|
|
2
|
|
|
|
|
32
|
|
9
|
2
|
|
|
2
|
|
1043
|
use Mojo::Util (); |
|
2
|
|
|
|
|
67805
|
|
|
2
|
|
|
|
|
395
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# version |
12
|
|
|
|
|
|
|
our $VERSION = 0.022; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub import { |
15
|
|
|
|
|
|
|
# caller is a consumer, import with |
16
|
|
|
|
|
|
|
# it is assumed that the caller's Mojo::Base imported strict already |
17
|
5
|
100
|
66
|
5
|
|
2004
|
if (@_ > 1 and $_[1] eq '-with') { |
18
|
1
|
|
|
|
|
3
|
@_ = 'Role::Tiny::With'; |
19
|
1
|
|
|
|
|
92
|
goto &Role::Tiny::With::import; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# the caller is a role |
23
|
|
|
|
|
|
|
# roles are strict |
24
|
4
|
|
|
|
|
16
|
Mojo::Base->import('-strict'); |
25
|
4
|
|
|
|
|
319
|
my $target = caller; |
26
|
4
|
|
|
0
|
|
17
|
Mojo::Util::monkey_patch $target, has => sub { Mojo::Base::attr($target, @_) }; |
|
0
|
|
|
0
|
|
0
|
|
27
|
|
|
|
|
|
|
|
28
|
4
|
|
|
|
|
54
|
@_ = 'Role::Tiny'; |
29
|
4
|
|
|
|
|
13
|
goto &Role::Tiny::import; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
1; |
33
|
|
|
|
|
|
|
__END__ |