Commit | Line | Data |
12e6eab8 |
1 | package Data::Query::ExprHelpers; |
2 | |
3 | use strictures 1; |
9c8fc055 |
4 | use Data::Query::Constants qw(DQ_VALUE DQ_OPERATOR DQ_IDENTIFIER); |
12e6eab8 |
5 | |
6 | use base qw(Exporter); |
7 | |
9c8fc055 |
8 | our @EXPORT_OK = qw(perl_scalar_value perl_operator identifier); |
12e6eab8 |
9 | |
10 | sub perl_scalar_value { |
11 | +{ |
9c8fc055 |
12 | type => DQ_VALUE, |
13 | subtype => { Perl => 'Scalar' }, |
7f462f86 |
14 | value => $_[0], |
15 | $_[1] ? (value_meta => $_[1]) : () |
12e6eab8 |
16 | } |
17 | } |
18 | |
19 | sub perl_operator { |
20 | my ($op, @args) = @_; |
21 | +{ |
22 | type => DQ_OPERATOR, |
23 | operator => { Perl => $op }, |
24 | args => \@args |
25 | } |
26 | } |
27 | |
9c8fc055 |
28 | sub identifier { |
29 | +{ |
30 | type => DQ_IDENTIFIER, |
31 | elements => [ @_ ] |
32 | } |
33 | } |
34 | |
12e6eab8 |
35 | 1; |