add exists, convert dot_ssh to use prop for everything
[scpubgit/DKit.git] / t / observe.t
index 8fbac7f..f3594c6 100644 (file)
@@ -2,7 +2,6 @@ use strictures 1;
 use Test::More;
 use aliased 'DX::Op::FromCode';
 use aliased 'DX::ArrayStream';
-use DX::ResultStream;
 use DX::Var;
 use DX::State;
 use DX::ObservationRequired;
@@ -16,7 +15,8 @@ my %paths = %observe_path;
 my $set_dot_ssh = FromCode->new(
   code => sub {
     my ($self, $state) = @_;
-    $state->bind_var_then($state->scope_var('P'), '/home/me/.ssh', $self->next);
+    $state->bind_value($state->scope_var('P')->id, '/home/me/.ssh')
+          ->then($self->next);
   }
 );
 
@@ -24,7 +24,8 @@ my $path_status = FromCode->new(
   code => sub {
     my ($self, $state) = @_;
     if (my $p = $paths{$state->scope_var('P')->bound_value}) {
-      return $state->bind_var_then($state->scope_var('PS'), $p, $self->next);
+      return $state->bind_value($state->scope_var('PS')->id, $p)
+                   ->then($self->next);
     }
     return $state->backtrack;
   }
@@ -82,7 +83,7 @@ my @path_status = (
       my $path = $state->scope_var('P')->bound_value;
       $state->return_from_run(
         DX::ObservationRequired->new(
-          observation => sub { $paths{$path} = $observe_path{$path} },
+          observer => sub { $paths{$path} = $observe_path{$path} },
           resume => $state->then($self->next),
         )
       );
@@ -113,7 +114,7 @@ my $or_state = make_state([ 'P', 'PS' ],
 
 my $ob_req = $or_state->run;
 
-$ob_req->observation->();
+$ob_req->observer->();
 
 {
   my $res = $ob_req->resume->run;