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' }, |
14 | value => $_[0] |
12e6eab8 |
15 | } |
16 | } |
17 | |
18 | sub perl_operator { |
19 | my ($op, @args) = @_; |
20 | +{ |
21 | type => DQ_OPERATOR, |
22 | operator => { Perl => $op }, |
23 | args => \@args |
24 | } |
25 | } |
26 | |
9c8fc055 |
27 | sub identifier { |
28 | +{ |
29 | type => DQ_IDENTIFIER, |
30 | elements => [ @_ ] |
31 | } |
32 | } |
33 | |
12e6eab8 |
34 | 1; |