line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MooX::Should; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# ABSTRACT: optional type restrictions for Moo attributes |
4
|
|
|
|
|
|
|
|
5
|
3
|
|
|
3
|
|
423434
|
use version 0.77 (); |
|
3
|
|
|
|
|
5969
|
|
|
3
|
|
|
|
|
82
|
|
6
|
|
|
|
|
|
|
|
7
|
3
|
|
|
3
|
|
20
|
use Moo (); |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
39
|
|
8
|
3
|
|
|
3
|
|
1494
|
use Moo::Role (); |
|
3
|
|
|
|
|
26404
|
|
|
3
|
|
|
|
|
209
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $USE_MOO_UTILS; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
BEGIN { |
13
|
3
|
50
|
|
3
|
|
289
|
if( version->parse( Moo->VERSION ) >= version->parse('2.003006') ) { |
14
|
0
|
|
|
|
|
0
|
$USE_MOO_UTILS = 1; |
15
|
0
|
|
|
|
|
0
|
require Moo::_Utils; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
3
|
|
|
3
|
|
1014
|
use Devel::StrictMode; |
|
3
|
|
|
|
|
843
|
|
|
3
|
|
|
|
|
649
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
our $VERSION = 'v0.1.3'; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub import { |
25
|
4
|
|
|
4
|
|
1188
|
my ($class) = @_; |
26
|
|
|
|
|
|
|
|
27
|
4
|
|
|
|
|
22
|
my $target = caller; |
28
|
|
|
|
|
|
|
|
29
|
4
|
100
|
|
|
|
162
|
my $installer = |
|
|
50
|
|
|
|
|
|
30
|
|
|
|
|
|
|
$USE_MOO_UTILS |
31
|
|
|
|
|
|
|
? \&Moo::_Utils::_install_tracked |
32
|
|
|
|
|
|
|
: $target->isa("Moo::Object") |
33
|
|
|
|
|
|
|
? \&Moo::_install_tracked |
34
|
|
|
|
|
|
|
: \&Moo::Role::_install_tracked; |
35
|
|
|
|
|
|
|
|
36
|
4
|
50
|
|
|
|
38
|
if ( my $has = $target->can('has') ) { |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
my $wrapper = sub { |
39
|
7
|
|
|
7
|
|
440937
|
my ( $name, %args ) = @_; |
40
|
|
|
|
|
|
|
|
41
|
7
|
50
|
|
|
|
55
|
if ( my $should = delete $args{should} ) { |
42
|
7
|
|
|
|
|
61
|
$args{isa} = $should if STRICT; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
7
|
|
|
|
|
44
|
return $has->( $name => %args ); |
46
|
4
|
|
|
|
|
19
|
}; |
47
|
|
|
|
|
|
|
|
48
|
4
|
|
|
|
|
18
|
$installer->( $target, "has", $wrapper ); |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
1; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
__END__ |