line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::BoolFindGrep; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
56994
|
use common::sense; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
10
|
|
4
|
1
|
|
|
1
|
|
824
|
use charnames q(:full); |
|
1
|
|
|
|
|
24535
|
|
|
1
|
|
|
|
|
6
|
|
5
|
1
|
|
|
1
|
|
968
|
use English qw[-no_match_vars]; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
6
|
1
|
|
|
1
|
|
873
|
use Moo; |
|
1
|
|
|
|
|
10919
|
|
|
1
|
|
|
|
|
6
|
|
7
|
1
|
|
|
1
|
|
1740
|
use App::BoolFindGrep::Find; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
33
|
|
8
|
1
|
|
|
1
|
|
524
|
use App::BoolFindGrep::Grep; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
30
|
|
9
|
1
|
|
|
1
|
|
466
|
use App::BoolFindGrep::Bool; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
962
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.06'; # VERSION |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has find => ( |
14
|
|
|
|
|
|
|
is => q(ro), |
15
|
|
|
|
|
|
|
default => sub { App::BoolFindGrep::Find->new(); } |
16
|
|
|
|
|
|
|
); |
17
|
|
|
|
|
|
|
has grep => ( |
18
|
|
|
|
|
|
|
is => q(ro), |
19
|
|
|
|
|
|
|
default => sub { App::BoolFindGrep::Grep->new(); } |
20
|
|
|
|
|
|
|
); |
21
|
|
|
|
|
|
|
has bool => ( |
22
|
|
|
|
|
|
|
is => q(ro), |
23
|
|
|
|
|
|
|
default => sub { App::BoolFindGrep::Bool->new(); } |
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
has found_files => ( |
26
|
|
|
|
|
|
|
is => q(rw), |
27
|
|
|
|
|
|
|
default => sub { []; }, |
28
|
|
|
|
|
|
|
); |
29
|
|
|
|
|
|
|
has greped_files => ( |
30
|
|
|
|
|
|
|
is => q(rw), |
31
|
|
|
|
|
|
|
default => sub { []; }, |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub BUILD { |
35
|
11
|
|
|
11
|
0
|
64
|
my $self = shift; |
36
|
11
|
|
|
|
|
18
|
my $args = shift; |
37
|
|
|
|
|
|
|
|
38
|
11
|
|
|
|
|
43
|
foreach my $method ( keys %$args ) { |
39
|
33
|
|
|
|
|
48
|
foreach my $class (qw[bool find grep]) { |
40
|
99
|
100
|
|
|
|
734
|
if ( $self->$class->can($method) ) { |
41
|
33
|
|
|
|
|
55
|
my $value = delete $args->{$method}; |
42
|
33
|
|
|
|
|
537
|
$self->$class->$method($value); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
11
|
50
|
|
|
|
58
|
die if %{$args}; |
|
11
|
|
|
|
|
45
|
|
48
|
|
|
|
|
|
|
|
49
|
11
|
|
|
|
|
178
|
return 1; |
50
|
|
|
|
|
|
|
} ## end sub BUILD |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub process { |
53
|
11
|
|
|
11
|
1
|
128
|
my $self = shift; |
54
|
|
|
|
|
|
|
|
55
|
11
|
50
|
|
|
|
41
|
return unless $self->_find_files(); |
56
|
11
|
50
|
|
|
|
55
|
return unless $self->_grep_files(); |
57
|
|
|
|
|
|
|
|
58
|
0
|
|
|
|
|
0
|
return 1; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub _find_files { |
62
|
11
|
|
|
11
|
|
20
|
my $self = shift; |
63
|
|
|
|
|
|
|
|
64
|
11
|
50
|
|
|
|
178
|
if ( defined $self->find->file_expr() ) { |
65
|
11
|
|
|
|
|
240
|
$self->bool->expression( $self->find->file_expr() ); |
66
|
11
|
50
|
|
|
|
118
|
return unless $self->bool->parse_expr(); |
67
|
11
|
|
|
|
|
16
|
foreach my $operand ( @{ $self->bool->operands() } ) { |
|
11
|
|
|
|
|
50
|
|
68
|
11
|
|
|
|
|
57
|
$self->find->patterns->{$operand} = undef; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
} |
71
|
11
|
50
|
|
|
|
64
|
return unless $self->find->process(); |
72
|
|
|
|
|
|
|
|
73
|
11
|
50
|
|
|
|
546
|
if ( defined $self->find->file_expr() ) { |
74
|
11
|
|
|
|
|
108
|
foreach my $file ( keys %{ $self->find->found() } ) { |
|
11
|
|
|
|
|
586
|
|
75
|
3960
|
|
|
|
|
9470
|
my $operand = $self->find->found->{$file}; |
76
|
3960
|
|
|
|
|
13705
|
my $result = $self->bool->lazy_solver(%$operand); |
77
|
3960
|
100
|
|
|
|
7892
|
push @{ $self->found_files() }, $file if $result; |
|
3120
|
|
|
|
|
8202
|
|
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
} |
80
|
0
|
|
|
|
|
0
|
else { $self->found_files( $self->find->files() ); } |
81
|
|
|
|
|
|
|
|
82
|
11
|
|
|
|
|
597
|
return 1; |
83
|
|
|
|
|
|
|
} ## end sub _find_files |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub _grep_files { |
86
|
11
|
|
|
11
|
|
24
|
my $self = shift; |
87
|
|
|
|
|
|
|
|
88
|
11
|
50
|
|
|
|
251
|
return unless defined $self->grep->match_expr(); |
89
|
|
|
|
|
|
|
|
90
|
0
|
|
|
|
|
|
$self->bool->expression( $self->grep->match_expr() ); |
91
|
0
|
0
|
|
|
|
|
return unless $self->bool->parse_expr(); |
92
|
|
|
|
|
|
|
|
93
|
0
|
|
|
|
|
|
foreach my $operand ( @{ $self->bool->operands() } ) { |
|
0
|
|
|
|
|
|
|
94
|
0
|
|
|
|
|
|
$self->grep->patterns->{$operand} = undef; |
95
|
|
|
|
|
|
|
} |
96
|
0
|
|
|
|
|
|
$self->grep->process( @{ $self->found_files() } ); |
|
0
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
|
98
|
0
|
|
|
|
|
|
foreach my $file ( keys %{ $self->grep->greped() } ) { |
|
0
|
|
|
|
|
|
|
99
|
0
|
|
|
|
|
|
my $operand = $self->grep->greped->{$file}; |
100
|
0
|
|
|
|
|
|
my $result = $self->bool->lazy_solver(%$operand); |
101
|
0
|
0
|
|
|
|
|
push @{ $self->greped_files() }, $file if $result; |
|
0
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
0
|
|
|
|
|
|
return 1; |
105
|
|
|
|
|
|
|
} ## end sub _grep_files |
106
|
|
|
|
|
|
|
|
107
|
1
|
|
|
1
|
|
6
|
no Moo; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
4
|
|
108
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
1; |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
__END__ |