allow observer to enter N facts
Matt S Trout [Wed, 19 Feb 2014 21:07:37 +0000 (21:07 +0000)]
lib/DX/ResultStream.pm

index 5816b03..559c1f1 100644 (file)
@@ -25,9 +25,11 @@ sub next {
     last if $state->isa('DX::State');
     if ($state->isa('DX::ObservationRequired')) {
       if ($self->observation_policy->($state->observer)) {
-        my ($type, $value) = $state->observer->run;
+        my @ob = $state->observer->run;
         $state = $state->resume;
-        $state->facts->{$type}->set_value($value);
+        while (my ($type, $value) = splice(@ob, 0, 2)) {
+          $state->facts->{$type}->set_value($value);
+        }
       } else {
         die "Observation refused";
       }