line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
3
|
|
|
3
|
|
79651
|
use 5.20.0; |
|
3
|
|
|
|
|
18
|
|
2
|
3
|
|
|
3
|
|
14
|
use strict; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
64
|
|
3
|
3
|
|
|
3
|
|
14
|
use warnings; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
175
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package DBIx::Class::Smooth::Q; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# ABSTRACT: Short intro |
8
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:CSSON'; # AUTHORITY |
9
|
|
|
|
|
|
|
our $VERSION = '0.0102'; |
10
|
|
|
|
|
|
|
|
11
|
3
|
|
|
3
|
|
17
|
use Carp qw/croak/; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
122
|
|
12
|
3
|
|
|
3
|
|
380
|
use Safe::Isa qw/$_isa/; |
|
3
|
|
|
|
|
399
|
|
|
3
|
|
|
|
|
236
|
|
13
|
3
|
|
|
3
|
|
425
|
use List::SomeUtils qw/any/; |
|
3
|
|
|
|
|
10354
|
|
|
3
|
|
|
|
|
142
|
|
14
|
3
|
|
|
3
|
|
1361
|
use Moo; |
|
3
|
|
|
|
|
17531
|
|
|
3
|
|
|
|
|
13
|
|
15
|
3
|
|
|
|
|
66
|
use Sub::Exporter::Progressive -setup => { |
16
|
|
|
|
|
|
|
exports => [qw/Q/], |
17
|
|
|
|
|
|
|
groups => { |
18
|
|
|
|
|
|
|
default => [qw/Q/], |
19
|
|
|
|
|
|
|
}, |
20
|
3
|
|
|
3
|
|
3943
|
}; |
|
3
|
|
|
|
|
6
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
use overload |
23
|
3
|
|
|
|
|
18
|
'&' => 'do_and', |
24
|
|
|
|
|
|
|
'|' => 'do_or', |
25
|
3
|
|
|
3
|
|
1367
|
'~' => 'do_not'; |
|
3
|
|
|
|
|
781
|
|
26
|
|
|
|
|
|
|
|
27
|
3
|
|
|
3
|
|
703
|
use experimental qw/signatures postderef/; |
|
3
|
|
|
|
|
2744
|
|
|
3
|
|
|
|
|
17
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
has value => ( |
30
|
|
|
|
|
|
|
is => 'rw', |
31
|
|
|
|
|
|
|
); |
32
|
|
|
|
|
|
|
|
33
|
37
|
|
|
37
|
0
|
8037
|
sub Q(@args) { |
|
37
|
|
|
|
|
63
|
|
|
37
|
|
|
|
|
67
|
|
34
|
37
|
100
|
66
|
|
|
80
|
if(scalar @args == 1 && $args[0]->$_isa('DBIx::Class::Smooth::Q')) { |
35
|
3
|
|
|
|
|
52
|
return $args[0]; |
36
|
|
|
|
|
|
|
} |
37
|
34
|
|
|
|
|
462
|
return DBIx::Class::Smooth::Q->new(value => [-and => \@args]); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
12
|
|
|
12
|
|
15
|
sub _prepare_do_and($self, $other) { |
|
12
|
|
|
|
|
13
|
|
|
12
|
|
|
|
|
13
|
|
|
12
|
|
|
|
|
13
|
|
41
|
12
|
|
|
|
|
33
|
my %self_values_as_flathash = ($self->value->[1]->@*); |
42
|
12
|
|
|
|
|
28
|
my @self_valuekeys = keys %self_values_as_flathash; |
43
|
|
|
|
|
|
|
|
44
|
12
|
50
|
|
20
|
|
45
|
if(any { $_ eq '-and' } @self_valuekeys) { |
|
20
|
|
|
|
|
37
|
|
45
|
|
|
|
|
|
|
ATTEMPT: |
46
|
0
|
|
|
|
|
0
|
while(1) { |
47
|
|
|
|
|
|
|
VALUE: |
48
|
0
|
|
|
|
|
0
|
for (my $i = 0; $i < scalar $self->value->[1]->@*; $i += 2) { |
49
|
0
|
|
|
|
|
0
|
my $key = $self->value->[1][$i]; |
50
|
0
|
0
|
|
|
|
0
|
if($key eq '-and') { |
51
|
0
|
|
|
|
|
0
|
push $other->value->[1]->@* => $self->value->[1][$i+1]->@*; |
52
|
0
|
|
|
|
|
0
|
splice $self->value->[1]->@*, $i, 2; |
53
|
0
|
|
|
|
|
0
|
next ATTEMPT; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
} |
56
|
0
|
|
|
|
|
0
|
last ATTEMPT; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
12
|
|
|
|
|
39
|
return $self, $other; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
12
|
|
|
12
|
0
|
120
|
sub do_and($self, $other, $swap) { |
|
12
|
|
|
|
|
12
|
|
|
12
|
|
|
|
|
15
|
|
|
12
|
|
|
|
|
14
|
|
|
12
|
|
|
|
|
15
|
|
64
|
12
|
|
|
|
|
20
|
($self, $other) = $self->_prepare_do_and($other); |
65
|
12
|
|
|
|
|
20
|
my $self_value = $self->value; |
66
|
12
|
|
|
|
|
18
|
my $other_value = $other->value; |
67
|
|
|
|
|
|
|
|
68
|
12
|
100
|
|
|
|
20
|
if($self_value->[0] eq '-and') { |
69
|
9
|
|
|
|
|
10
|
$self_value = $self_value->[1]; |
70
|
|
|
|
|
|
|
} |
71
|
12
|
100
|
|
|
|
22
|
if($other_value->[0] eq '-and') { |
72
|
9
|
|
|
|
|
11
|
$other_value = $other_value->[1]; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
12
|
|
|
|
|
26
|
my $value = [-and => [$self_value->@*, $other_value->@* ]]; |
76
|
|
|
|
|
|
|
|
77
|
12
|
|
|
|
|
168
|
return DBIx::Class::Smooth::Q->new(value => $value); |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
15
|
|
|
15
|
0
|
175
|
sub do_or($self, $other, $swap) { |
|
15
|
|
|
|
|
19
|
|
|
15
|
|
|
|
|
16
|
|
|
15
|
|
|
|
|
16
|
|
|
15
|
|
|
|
|
16
|
|
81
|
15
|
|
|
|
|
24
|
my $self_value = $self->value; |
82
|
15
|
|
|
|
|
20
|
my $other_value = $other->value; |
83
|
|
|
|
|
|
|
|
84
|
15
|
100
|
100
|
|
|
42
|
if($self_value->[0] eq '-or' && $self_value->[1][0] eq '-or') { |
85
|
4
|
|
|
|
|
16
|
splice $self_value->[1]->@*, 0, 2, $self_value->[1][1]->@*; |
86
|
|
|
|
|
|
|
} |
87
|
15
|
50
|
33
|
|
|
29
|
if($other_value->[0] eq '-or' && $other_value->[1][0] eq '-or') { |
88
|
0
|
|
|
|
|
0
|
splice $other_value->[1]->@*, 0, 2, $other_value->[1][1]->@*; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
15
|
100
|
100
|
|
|
41
|
if($self_value->[0] eq '-and' && scalar $self_value->[1]->@* == 2) { |
92
|
6
|
|
|
|
|
8
|
$self_value = $self_value->[1]; |
93
|
|
|
|
|
|
|
} |
94
|
15
|
50
|
33
|
|
|
39
|
if($other_value->[0] eq '-and' && scalar $other_value->[1]->@* == 2) { |
95
|
15
|
|
|
|
|
18
|
$other_value = $other_value->[1]; |
96
|
|
|
|
|
|
|
} |
97
|
15
|
|
|
|
|
35
|
my $value = [-or => [$self_value->@*, $other_value->@* ]]; |
98
|
|
|
|
|
|
|
|
99
|
15
|
|
|
|
|
198
|
return DBIx::Class::Smooth::Q->new(value => $value); |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
0
|
|
|
0
|
0
|
|
sub do_not($self, $undef, $swap) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
103
|
0
|
|
|
|
|
|
return DBIx::Class::Smooth::Q->new(value => [-not_bool => [$self->value->@*]]); |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
1; |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
__END__ |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=pod |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=encoding UTF-8 |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head1 NAME |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
DBIx::Class::Smooth::Q - Short intro |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head1 VERSION |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
Version 0.0102, released 2019-12-22. |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head1 SOURCE |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
L<https://github.com/Csson/p5-DBIx-Class-Smooth> |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head1 HOMEPAGE |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
L<https://metacpan.org/release/DBIx-Class-Smooth> |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head1 AUTHOR |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
Erik Carlsson <info@code301.com> |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
This software is copyright (c) 2018 by Erik Carlsson. |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
139
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=cut |