line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojo::RoleTiny; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# ABSTRACT: Mojo::RoleTiny - Tiny and simple role system for Mojo |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# imports |
6
|
2
|
|
|
2
|
|
32004
|
use Mojo::Base -strict; |
|
2
|
|
|
|
|
13870
|
|
|
2
|
|
|
|
|
12
|
|
7
|
2
|
|
|
2
|
|
1134
|
use Role::Tiny (); |
|
2
|
|
|
|
|
5816
|
|
|
2
|
|
|
|
|
34
|
|
8
|
2
|
|
|
2
|
|
733
|
use Role::Tiny::With (); |
|
2
|
|
|
|
|
423
|
|
|
2
|
|
|
|
|
33
|
|
9
|
2
|
|
|
2
|
|
1047
|
use Mojo::Util (); |
|
2
|
|
|
|
|
68712
|
|
|
2
|
|
|
|
|
292
|
|
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
|
|
1848
|
if (@_ > 1 and $_[1] eq '-with') { |
18
|
1
|
|
|
|
|
3
|
@_ = 'Role::Tiny::With'; |
19
|
1
|
|
|
|
|
84
|
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
|
|
|
|
|
275
|
my $target = caller; |
26
|
4
|
|
|
0
|
|
16
|
Mojo::Util::monkey_patch $target, has => sub { Mojo::Base::attr($target, @_) }; |
|
0
|
|
|
0
|
|
0
|
|
27
|
|
|
|
|
|
|
|
28
|
4
|
|
|
|
|
57
|
@_ = 'Role::Tiny'; |
29
|
4
|
|
|
|
|
10
|
goto &Role::Tiny::import; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
1; |
33
|
|
|
|
|
|
|
__END__ |