Skip to content

Instantly share code, notes, and snippets.

@hdp
Created September 6, 2011 02:29
Show Gist options
  • Save hdp/1196423 to your computer and use it in GitHub Desktop.
Save hdp/1196423 to your computer and use it in GitHub Desktop.
{ package Plack::Util::RunAfterRequest; sub DESTROY { $_[0]->() } }
sub Plack::Util::run_after_request {
my ($env, $code) = @_;
my $queue = $env->{'plack.run_after_request'} ||= [];
push @$queue, bless sub { $code->() }, 'Plack::Util::RunAfterRequest';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment