NAME
Devel::hdb::App::Response - Manage responses from the debugger to the user interface
SYNOPSIS
my $queued = Devel::hdb::Response->queue('program_name');
$queued->data('test.pl');
my $resp = Devel::hdb::Response->new('ping');
$io->print $resp->encode();
DESCRIPTION
This class is used to create and enqueue messages to send to the user interface.
Constructor
- $resp = new($type [, $env])
-
Creates a new message with the given 'type' field. $env is an optional PSGI environment hash. If given, and the environment has a parameter 'rid', then its value is copied to the Response instance.
- $resp = queue($type [, $env])
-
Creates a new message just as new() does. The newly created message is added to the list of queued messages to be included in some future call to encode.
Methods
- $resp->data($data)
-
Mutator for getting or setting the 'data' field of the message. Accepts only a single scalar, which may be a reference to a more complicated type.
- $string = $resp->encode();
-
Returns a JSON-encoded string representing the message. If there are any queued messages, the response is an array of all the messages, with the invocant first in the array. After the call to encode(), the queued list is emptied.
SEE ALSO
Devel::hdb, JSON
AUTHOR
Anthony Brummett <brummett@cpan.org>
COPYRIGHT
Copyright 2014, Anthony Brummett. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.