The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Articulate::Response - represent a response

FUNCTIONS

response

new_response

  my $response = new_response type => $data;

Creates a new response, using the type and data supplied as the respective arguments. Using this constructor, the error code will be 200 unless type is error.

METHODS

new

An unremarkable Moo constructor.

serialise

Sends the response to Articulate::Serialisation->serialise.

Note: the behaviour of this method may change!

ATTRIBUTES

http_code

The HTTP response code which best applies to the response. The default is 500.

It is not guaranteed that this will be passed to the ultimate client (e.g. a later error may cause a 500; the service may be accessed in a way other than HTTP).

type

The type of response, which will be used by serialisers etc. to determine how to complete processing (e.g. which template to use).

data

The actual content of the response, including any metadata. Typically this will be of the form

  {
    item => {
      article => {
        meta    => { ... }
        content => " ... "
      }
    }
  }