HELPERS

accepts

Select best possible representation for resource from Accept request header, format stash value or formatGET/POST parameter with "accepts" in Mojolicious::Renderer, defaults to returning the first extension if no preference could be detected.

config

content

Store partial rendered content in a named buffer and retrieve it later, defaults to retrieving the named buffer content, which is commonly used for the renderers layout and extends features. New content will be ignored if the named buffer is already in use.

content_for

% content_for foo => begin
test
% end
%= content_for 'foo'

Same as "content", but appends content to named buffers if they are already in use.

csrf_token

current_route

delay

$c->delay(sub {...}, sub {...});

Disable automatic rendering and use "delay" in Mojo::IOLoop to manage callbacks and control the flow of events, which can help you avoid deep nested closures that often result from continuation-passing style. Also keeps a reference to "tx" in Mojolicious::Controller in case the underlying connection gets closed early, and calls "reply->exception" if an exception gets thrown in one of the steps, breaking the chain.

reply->exception

Render the exception template exception.$mode.$format.* or exception.$format.* and set the response status code to 500. Also sets the stash values exception to a Mojo::Exception object and snapshot to a copy of the "stash" for use in the templates.

reply->not_found

$c = $c->reply->not_found;

Render the not found template not_found.$mode.$format.* or not_found.$format.* and set the response status code to 404. Also sets the stash value snapshot to a copy of the "stash" for use in the templates.

reply->static

Reply with a static file using "static" in Mojolicious, usually from the public directories or DATA sections of your application. Note that this helper does not protect from traversing to parent directories.