=head1 SYNOPSIS
use Dancer2::Plugin::Deferred;
get '/defer' => sub { deferred error => "Klaatu barada nikto"; redirect '/later'; }
get '/later' => sub { template 'later'; }
<% IF deferred.error %>
<% END %>
=head1 DESCRIPTION
This L
It works by creating a unique message ID within the session that holds deferred data. The message ID is automatically added as a query parameter to redirection requests. It's sort of like a session within a session, but tied to a request rather than global to the browser. (It will even chain across multiple redirects.)
When a template is rendered, a pre-template hook retrieves the data and deletes it from the session. Alternatively, the data can be retrieved manually (which will also automatically delete the data.)
Alternatively, the message ID parameters can be retrieved and used to construct a hyperlink for a message to be retrieved later. In this case, the message is preserved past the template hook. (The template should be sure not to render the message if not desired.)
=head1 USAGE
=head2 deferred
deferred $key => $value; $value = deferred $key; # also deletes $key
This function works just like C or C
=head2 all_deferred
template 'index', { deferred => all_deferred };
This function returns all the deferred data as a hash reference and deletes
the stored data. This is called automatically in the C
=head2 deferred_param
template 'index' => { link => uri_for( '/other', { deferred_param } ) };
This function returns the parameter key and value used to propagate the
message to another request. Using this function toggles the C
=head1 CONFIGURATION
=head1 SEE ALSO
=head1 ACKNOWLEDGMENTS
Thank you to mst for explaining why L