{"id":28614216,"url":"https://github.com/perldancer/dancer-plugin-deferred","last_synced_at":"2026-05-29T08:04:23.824Z","repository":{"id":6024043,"uuid":"7247931","full_name":"PerlDancer/dancer-plugin-deferred","owner":"PerlDancer","description":"Deferred messages for Dancer","archived":false,"fork":false,"pushed_at":"2012-12-26T16:31:21.000Z","size":132,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-05-09T11:35:33.586Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://metacpan.org/author/DAGOLDEN","language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PerlDancer.png","metadata":{"files":{"readme":"README.pod","changelog":"Changes","contributing":"CONTRIBUTING","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-12-19T21:49:16.000Z","updated_at":"2019-09-24T13:24:09.000Z","dependencies_parsed_at":"2022-09-13T09:11:09.532Z","dependency_job_id":null,"html_url":"https://github.com/PerlDancer/dancer-plugin-deferred","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/PerlDancer/dancer-plugin-deferred","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PerlDancer%2Fdancer-plugin-deferred","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PerlDancer%2Fdancer-plugin-deferred/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PerlDancer%2Fdancer-plugin-deferred/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PerlDancer%2Fdancer-plugin-deferred/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PerlDancer","download_url":"https://codeload.github.com/PerlDancer/dancer-plugin-deferred/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PerlDancer%2Fdancer-plugin-deferred/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259374995,"owners_count":22847878,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-12T01:13:27.474Z","updated_at":"2025-10-24T02:45:02.009Z","avatar_url":"https://github.com/PerlDancer.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"=pod\n\n=head1 NAME\n\nDancer::Plugin::Deferred - Defer messages or data across redirections\n\n=head1 VERSION\n\nversion 0.003\n\n=head1 SYNOPSIS\n\n  use Dancer::Plugin::Deferred;\n\n  get '/defer' =\u003e sub {\n    deferred error =\u003e \"Klaatu barada nikto\";\n    redirect '/later';\n  }\n\n  get '/later' =\u003e sub {\n    template 'later';\n  }\n\n  # in template 'later.tt'\n  \u003c% IF deferred.error %\u003e\n  \u003cdiv class=\"error\"\u003e\u003c% deferred.error %\u003e\u003c/div\u003e\n  \u003c% END %\u003e\n\n=head1 DESCRIPTION\n\nThis L\u003cDancer\u003e plugin provides a method for deferring a one-time message across\na redirect.  It is similar to \"flash\" messages, but without the race conditions\nthat can result from multiple tabs in a browser or from AJAX requests.  It is\nsimilar in design to L\u003cCatalyst::Plugin::StatusMessage\u003e, but adapted for Dancer.\n\nIt works by creating a unique message ID within the session that holds deferred\ndata.  The message ID is automatically added as a query parameter to redirection\nrequests.  It's sort of like a session within a session, but tied to a request\nrather than global to the browser.  (It will even chain across multiple\nredirects.)\n\nWhen a template is rendered, a pre-template hook retrieves the data and\ndeletes it from the session.  Alternatively, the data can be retrieved manually\n(which will also automatically delete the data.)\n\nAlternatively, the message ID parameters can be retrieved and used to\nconstruct a hyperlink for a message to be retrieved later.  In this case,\nthe message is preserved past the template hook.  (The template should be\nsure not to render the message if not desired.)\n\n=for Pod::Coverage method_names_here\n\n=head1 USAGE\n\n=head2 deferred\n\n  deferred $key =\u003e $value;\n  $value = deferred $key; # also deletes $key\n\nThis function works just like C\u003cvar\u003e or C\u003csession\u003e, except that it lasts only\nfor the current request and across any redirects.  Data is deleted if accessed.\nIf a key is set to an undefined value, the key is deleted from the deferred\ndata hash.\n\n=head2 all_deferred\n\n  template 'index', { deferred =\u003e all_deferred };\n\nThis function returns all the deferred data as a hash reference and deletes\nthe stored data.  This is called automatically in the C\u003cbefore_template_render\u003e\nhook, but is available if someone wants to have manual control.\n\n=head2 deferred_param\n\n  template 'index' =\u003e { link =\u003e uri_for( '/other', { deferred_param } ) };\n\nThis function returns the parameter key and value used to propagate the\nmessage to another request.  Using this function toggles the C\u003cvar_keep_key\u003e\nvariable to true to ensure the message remains to be retrieved by the link.\n\n=head1 CONFIGURATION\n\n=over 4\n\n=item *\n\nC\u003cvar_key: dpdid\u003e -- this is the key in the C\u003cvar\u003e hash containing the message ID\n\n=item *\n\nC\u003cvar_keep_key: dpd_keep\u003e -- if this key in C\u003cvar\u003e is true, retrieving values will not be destructive\n\n=item *\n\nC\u003cparams_key: dpdid\u003e -- this is the key in the C\u003cparams\u003e hash containing the message ID\n\n=item *\n\nC\u003csession_key_prefix\u003e: dpd_\u003e -- the message ID is appended to this prefix and used to store deferred data in the session\n\n=item *\n\nC\u003ctemplate_key: deferred\u003e -- this is the key to deferred data passed to the template\n\n=back\n\n=head1 SEE ALSO\n\n=over 4\n\n=item *\n\nL\u003cDancer\u003e\n\n=item *\n\nL\u003cDancer::Plugin::FlashMessage\u003e\n\n=item *\n\nL\u003cDancer::Plugin::FlashNote\u003e\n\n=item *\n\nL\u003cCatalyst::Plugin::StatusMessage\u003e\n\n=back\n\n=head1 ACKNOWLEDGMENTS\n\nThank you to mst for explaining why L\u003cCatalyst::Plugin::StatusMessages\u003e does\nwhat it does and putting up with my dumb ideas along the way.\n\n=for :stopwords cpan testmatrix url annocpan anno bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan\n\n=head1 SUPPORT\n\n=head2 Bugs / Feature Requests\n\nPlease report any bugs or feature requests through the issue tracker\nat L\u003chttps://github.com/dagolden/dancer-plugin-deferred/issues\u003e.\nYou will be notified automatically of any progress on your issue.\n\n=head2 Source Code\n\nThis is open source software.  The code repository is available for\npublic review and contribution under the terms of the license.\n\nL\u003chttps://github.com/dagolden/dancer-plugin-deferred\u003e\n\n  git clone git://github.com/dagolden/dancer-plugin-deferred.git\n\n=head1 AUTHOR\n\nDavid Golden \u003cdagolden@cpan.org\u003e\n\n=head1 COPYRIGHT AND LICENSE\n\nThis software is Copyright (c) 2012 by David Golden.\n\nThis is free software, licensed under:\n\n  The Apache License, Version 2.0, January 2004\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fperldancer%2Fdancer-plugin-deferred","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fperldancer%2Fdancer-plugin-deferred","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fperldancer%2Fdancer-plugin-deferred/lists"}