Subrequests (AKA method_lookup()-based API calls) sometimes append
final-lvalue responses to the response list even after respond_complete()
has been called from within the implementation method. This commit
discards all post-respond_complete values, protecting against extra,
spurious values being returned to the ultimate client.
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
sub respond {
my $self = shift;
+ return if $self->complete;
+
my $resp = shift;
push @{$$self{resp}}, $resp if (defined $resp);
}
-sub respond_complete { respond(@_); }
+
+sub respond_complete {
+ my $self = shift;
+ $self->respond(@_);
+ $self->complete(1);
+}
sub new {
my $class = shift;
$class = ref($class) || $class;
- return bless({resp => [], @_}, $class);
+ return bless({complete => 0, resp => [], @_}, $class);
}
sub responses { @{$_[0]->{resp}} }
return $x->{session};
}
+sub complete {
+ my $x = shift;
+ my $c = shift;
+ $x->{complete} = $c if ($c);
+ return $x->{complete};
+}
+
sub status {}