| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
2
|
|
|
2
|
|
1140
|
use 5.006; |
|
|
2
|
|
|
|
|
8
|
|
|
2
|
2
|
|
|
2
|
|
11
|
use strict; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
69
|
|
|
3
|
2
|
|
|
2
|
|
13
|
use warnings; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
132
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package LINQ::FieldSet; |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TOBYINK'; |
|
8
|
|
|
|
|
|
|
our $VERSION = '0.001'; |
|
9
|
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
13
|
use Class::Tiny qw( fields seen_asterisk ); |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
10
|
|
|
11
|
2
|
|
|
2
|
|
732
|
use LINQ::Util::Internal (); |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
832
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub _known_parameter_names { |
|
14
|
54
|
|
|
54
|
|
83
|
my ( $self ) = ( shift ); |
|
15
|
54
|
|
|
|
|
264
|
return (); |
|
16
|
|
|
|
|
|
|
} |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub BUILDARGS { |
|
19
|
55
|
|
|
55
|
1
|
797
|
my ( $class, @args ) = ( shift, @_ ); |
|
20
|
|
|
|
|
|
|
|
|
21
|
55
|
100
|
100
|
|
|
159
|
if ( @args == 1 and ref( $args[0] ) eq 'HASH' ) { |
|
22
|
1
|
|
|
|
|
4
|
return $args[0]; |
|
23
|
|
|
|
|
|
|
} |
|
24
|
|
|
|
|
|
|
|
|
25
|
54
|
|
|
|
|
1261
|
require LINQ::Field; |
|
26
|
|
|
|
|
|
|
|
|
27
|
54
|
|
|
|
|
149
|
my %known = $class->_known_parameter_names; |
|
28
|
|
|
|
|
|
|
|
|
29
|
54
|
|
|
|
|
97
|
my @fields; |
|
30
|
54
|
|
|
|
|
78
|
my $idx = 0; |
|
31
|
54
|
|
|
|
|
72
|
my $seen_asterisk; |
|
32
|
|
|
|
|
|
|
|
|
33
|
54
|
|
|
|
|
115
|
ARG: while ( @args ) { |
|
34
|
80
|
|
|
|
|
110
|
my $value = shift @args; |
|
35
|
80
|
100
|
|
|
|
157
|
if ( $value eq '*' ) { |
|
36
|
6
|
|
|
|
|
13
|
$seen_asterisk = 1; |
|
37
|
6
|
|
|
|
|
15
|
next ARG; |
|
38
|
|
|
|
|
|
|
} |
|
39
|
74
|
|
|
|
|
124
|
my %params = (); |
|
40
|
74
|
|
100
|
|
|
481
|
while ( @args and !ref $args[0] and $args[0] =~ /\A-/ ) { |
|
|
|
|
100
|
|
|
|
|
|
41
|
80
|
|
|
|
|
184
|
my $p_name = substr( shift( @args ), 1 ); |
|
42
|
80
|
100
|
|
|
|
180
|
if ( $known{$p_name} ) { |
|
|
|
100
|
|
|
|
|
|
|
43
|
63
|
|
|
|
|
311
|
$params{$p_name} = shift( @args ); |
|
44
|
|
|
|
|
|
|
} |
|
45
|
|
|
|
|
|
|
elsif ( exists $known{$p_name} ) { |
|
46
|
16
|
|
|
|
|
76
|
$params{$p_name} = 1; |
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
else { |
|
49
|
1
|
|
|
|
|
7
|
LINQ::Util::Internal::throw( |
|
50
|
|
|
|
|
|
|
'CallerError', |
|
51
|
|
|
|
|
|
|
message => "Unknown field parameter '$p_name'", |
|
52
|
|
|
|
|
|
|
); |
|
53
|
|
|
|
|
|
|
} |
|
54
|
|
|
|
|
|
|
} #/ while ( @args and !ref $args...) |
|
55
|
|
|
|
|
|
|
|
|
56
|
73
|
|
|
|
|
234
|
my $field = 'LINQ::Field'->new( |
|
57
|
|
|
|
|
|
|
value => $value, |
|
58
|
|
|
|
|
|
|
index => ++$idx, |
|
59
|
|
|
|
|
|
|
params => \%params, |
|
60
|
|
|
|
|
|
|
); |
|
61
|
73
|
|
|
|
|
452
|
push @fields, $field; |
|
62
|
|
|
|
|
|
|
} #/ ARG: while ( @args ) |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
return { |
|
65
|
53
|
|
|
|
|
217
|
fields => \@fields, |
|
66
|
|
|
|
|
|
|
seen_asterisk => $seen_asterisk, |
|
67
|
|
|
|
|
|
|
}; |
|
68
|
|
|
|
|
|
|
} #/ sub BUILDARGS |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub fields_hash { |
|
71
|
10
|
|
|
10
|
1
|
1927
|
my ( $self ) = ( shift ); |
|
72
|
10
|
|
100
|
|
|
100
|
$self->{fields_hash} ||= $self->_build_fields_hash; |
|
73
|
|
|
|
|
|
|
} |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub _build_fields_hash { |
|
76
|
6
|
|
|
6
|
|
9
|
my ( $self ) = ( shift ); |
|
77
|
6
|
|
|
|
|
9
|
my %fields; |
|
78
|
6
|
|
|
|
|
13
|
foreach my $field ( @{ $self->fields } ) { |
|
|
6
|
|
|
|
|
117
|
|
|
79
|
15
|
|
|
|
|
289
|
$fields{ $field->name } = $field; |
|
80
|
|
|
|
|
|
|
} |
|
81
|
6
|
|
|
|
|
65
|
return \%fields; |
|
82
|
|
|
|
|
|
|
} |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
1; |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
__END__ |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=pod |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=encoding utf-8 |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 NAME |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
LINQ::FieldSet - base class for LINQ::FieldSet::{Selection,Assertion} |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
This is used internally by LINQ and you probably don't need to know about it |
|
100
|
|
|
|
|
|
|
unless you're writing very specific extensions for LINQ. |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 CONSTRUCTOR |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=over |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=item C<< new( ARGSLIST ) >> |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
Constructs a fieldset from a list of fields like: |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
'LINQ::FieldSet'->new( |
|
111
|
|
|
|
|
|
|
'field1', -param1 => 'value1', -param2, |
|
112
|
|
|
|
|
|
|
'field2', -param1 => 'value2', |
|
113
|
|
|
|
|
|
|
); |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
The list of allowed parameters and whether each one takes a value is returned |
|
116
|
|
|
|
|
|
|
by the C<_known_parameter_names> method. This is empty in LINQ::FieldSet itself |
|
117
|
|
|
|
|
|
|
so doing anything interesting with this class probably requires subclassing. |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=back |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=begin trustme |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=item BUILDARGS |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=end trustme |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head1 METHODS |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=over |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=item C<fields> |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
An arrayref of fields in this fieldset. |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=item C<fields_hash> |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
The same, but as a hashref keyed on field name. |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=item C<seen_asterisk> |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
Whether "*" was seen by the constructor. |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=back |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=head1 BUGS |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
Please report any bugs to |
|
148
|
|
|
|
|
|
|
L<http://rt.cpan.org/Dist/Display.html?Queue=LINQ>. |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
L<LINQ::FieldSet>. |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=head1 AUTHOR |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
Toby Inkster E<lt>tobyink@cpan.orgE<gt>. |
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENCE |
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
This software is copyright (c) 2021 by Toby Inkster. |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
163
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=head1 DISCLAIMER OF WARRANTIES |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED |
|
168
|
|
|
|
|
|
|
WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF |
|
169
|
|
|
|
|
|
|
MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. |