| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# ABSTRACT: Common Methods for Operating on Code References |
|
2
|
|
|
|
|
|
|
package Bubblegum::Object::Code; |
|
3
|
|
|
|
|
|
|
|
|
4
|
36
|
|
|
36
|
|
19648
|
use 5.10.0; |
|
|
36
|
|
|
|
|
107
|
|
|
|
36
|
|
|
|
|
1468
|
|
|
5
|
36
|
|
|
36
|
|
153
|
use namespace::autoclean; |
|
|
36
|
|
|
|
|
49
|
|
|
|
36
|
|
|
|
|
203
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
36
|
|
|
36
|
|
2056
|
use Bubblegum::Class 'with'; |
|
|
36
|
|
|
|
|
51
|
|
|
|
36
|
|
|
|
|
267
|
|
|
8
|
36
|
|
|
36
|
|
26213
|
use Bubblegum::Constraints -isas, -types; |
|
|
36
|
|
|
|
|
57
|
|
|
|
36
|
|
|
|
|
465
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
with 'Bubblegum::Object::Role::Defined'; |
|
11
|
|
|
|
|
|
|
with 'Bubblegum::Object::Role::Ref'; |
|
12
|
|
|
|
|
|
|
with 'Bubblegum::Object::Role::Coercive'; |
|
13
|
|
|
|
|
|
|
with 'Bubblegum::Object::Role::Output'; |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our @ISA = (); # non-object |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
our $VERSION = '0.45'; # VERSION |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub call { |
|
20
|
19
|
|
|
19
|
1
|
3890
|
my $self = CORE::shift; |
|
21
|
19
|
|
|
|
|
34
|
my @args = @_; |
|
22
|
19
|
|
|
|
|
44
|
return $self->(@args); |
|
23
|
|
|
|
|
|
|
} |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub curry { |
|
26
|
2
|
|
|
2
|
1
|
2916
|
my $self = CORE::shift; |
|
27
|
2
|
|
|
|
|
6
|
my @args = @_; |
|
28
|
2
|
|
|
2
|
|
17
|
return sub { $self->(@args, @_) }; |
|
|
2
|
|
|
|
|
9
|
|
|
29
|
|
|
|
|
|
|
} |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub rcurry { |
|
32
|
1
|
|
|
1
|
1
|
3051
|
my $self = CORE::shift; |
|
33
|
1
|
|
|
|
|
3
|
my @args = @_; |
|
34
|
1
|
|
|
1
|
|
12
|
return sub { $self->(@_, @args) }; |
|
|
1
|
|
|
|
|
5
|
|
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub compose { |
|
38
|
1
|
|
|
1
|
1
|
3038
|
my $self = CORE::shift; |
|
39
|
1
|
|
|
|
|
8
|
my $next = type_coderef CORE::shift; |
|
40
|
1
|
|
|
|
|
425
|
my @args = @_; |
|
41
|
1
|
|
|
1
|
|
10
|
return (sub { $next->($self->(@_)) })->curry(@args); |
|
|
1
|
|
|
|
|
5
|
|
|
42
|
|
|
|
|
|
|
} |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub disjoin { |
|
45
|
1
|
|
|
1
|
1
|
3182
|
my $self = CORE::shift; |
|
46
|
1
|
|
|
|
|
5
|
my $next = type_coderef CORE::shift; |
|
47
|
1
|
100
|
|
5
|
|
53
|
return sub { $self->(@_) || $next->(@_) }; |
|
|
5
|
|
|
|
|
833
|
|
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub conjoin { |
|
51
|
1
|
|
|
1
|
1
|
2891
|
my $self = CORE::shift; |
|
52
|
1
|
|
|
|
|
5
|
my $next = type_coderef CORE::shift; |
|
53
|
1
|
100
|
|
5
|
|
52
|
return sub { $self->(@_) && $next->(@_) }; |
|
|
5
|
|
|
|
|
841
|
|
|
54
|
|
|
|
|
|
|
} |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub next { |
|
57
|
15
|
|
|
15
|
1
|
4231
|
goto &call; |
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub print { |
|
61
|
2
|
|
|
2
|
1
|
3284
|
my $self = CORE::shift; |
|
62
|
2
|
|
|
|
|
9
|
return CORE::print $self->(@_); |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub say { |
|
66
|
2
|
|
|
2
|
1
|
3400
|
my $self = CORE::shift; |
|
67
|
2
|
|
|
|
|
10
|
return print($self->(@_), "\n"); |
|
68
|
|
|
|
|
|
|
} |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
1; |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
__END__ |