Guide Home
POD Home



Sloop::Generic is used to generate and dispatch plain HTML pages for generic HTTP errors. It is used internally by the server. If you wish to customize the error pages, you can override the page() function, or, if you just want to change the text or add a status code (not all of them are covered), you can modify the $Pages hash. These are subroutines keyed by code (404, 500, etc.) that receive a Sloop::Client object to send the page to.

The $Pages hash ref is assigned to Client objects when constructed, so to use something customized you need to pass an appropriate client_constructor via the Sloop::Server constructor. See the 'generic' parameter in the Sloop::Client SYNOPSIS.

Included codes in the $Pages hash are 400, 403, 404, 408, 411, 413, 500, and 503.


Sloop::Generic::page($client, $status, $msg)

Sends a simple HTML 5 page indicating an error.

$client is a Sloop::Client derived object.

$status is an integer status code. It will be used in the HTTP header and appear on the page.

$msg is a text string to include in the page.