line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package UR::Role::MethodModifier::Before; |
2
|
1
|
|
|
1
|
|
89
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
28
|
|
3
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
46
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = "0.46"; # UR $VERSION; |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
4
|
use UR; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
7
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
UR::Object::Type->define( |
10
|
|
|
|
|
|
|
class_name => 'UR::Role::MethodModifier::Before', |
11
|
|
|
|
|
|
|
is => 'UR::Role::MethodModifier', |
12
|
|
|
|
|
|
|
); |
13
|
|
|
|
|
|
|
|
14
|
2
|
|
|
2
|
0
|
5
|
sub type { 'before' } |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub create_wrapper_sub { |
17
|
3
|
|
|
3
|
0
|
6
|
my($self, $original_sub) = @_; |
18
|
|
|
|
|
|
|
|
19
|
3
|
|
|
|
|
11
|
my $before = $self->code; |
20
|
|
|
|
|
|
|
return sub { |
21
|
4
|
50
|
|
4
|
|
598
|
if (wantarray) { |
|
|
50
|
|
4
|
|
|
|
|
|
|
|
4
|
|
|
|
22
|
0
|
|
|
|
|
0
|
() = $before->(@_); |
23
|
|
|
|
|
|
|
} elsif (defined wantarray) { |
24
|
4
|
|
|
|
|
12
|
my $rv = $before->(@_); |
25
|
|
|
|
|
|
|
} else { |
26
|
0
|
|
|
|
|
0
|
$before->(@_); |
27
|
|
|
|
|
|
|
} |
28
|
4
|
|
|
|
|
29
|
$original_sub->(@_); |
29
|
3
|
|
|
|
|
14
|
}; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
1; |