Commit | Line | Data |
---|---|---|
deec7cc4 | 1 | package DX::Op::Exists; |
2 | ||
3 | use DX::Op::SetScope; | |
4 | use Moo; | |
5 | ||
6 | has vars => (is => 'ro', required => 1); | |
7 | has body => (is => 'ro', required => 1); | |
8 | ||
9 | with 'DX::Role::Op'; | |
10 | ||
11 | sub run { | |
12 | my ($self, $state) = @_; | |
13 | my $ret_op = DX::Op::SetScope->new( | |
14 | scope => $state->scope, | |
15 | next => $self->next | |
16 | ); | |
17 | $state->assign_vars(map +($_ => {}), @{$self->vars}) | |
18 | ->push_return_then($ret_op, $self->body); | |
19 | } | |
20 | ||
21 | 1; |