plack-middleware-delay
文件大小: unknow
源码售价: 5 个金币 积分规则     积分充值
资源说明:Put delays on your PSGI application requests
=pod

=head1 NAME

Plack::Middleware::Delay - Put delays on your requests

=head1 VERSION

version 0.01

=head1 SYNOPSIS

  use Plack::Builder;

  builder {
      enable 'Delay', delay => 5; # delays the response by five seconds
      $app;
  };

  # or, if you're in an AnyEvent-based PSGI server...

  builder {
      enable 'Delay', delay => 5, sleep_fn => sub {
        my ( $delay, $invoke ) = @_;

        my $timer;
        $timer = AnyEvent->timer(
            after => $delay,
            cb    => sub {
                undef $timer;
                $invoke->();
            },
        );
      };
      $app;
  };

=head1 DESCRIPTION

This middleware imposes an artifical delay on requests, for purposes of
testing.  It could also be used to implement L.

=head1 OPTIONS

=head2 delay

The number of seconds to sleep.  It can be an integer or a float; however, the
default sleep_fn only works on integers.

=head2 sleep_fn

A subroutine reference that will be called when it's time to go to sleep.  The
subroutine reference will be provided two arguments: the number of seconds to
sleep (ie. the value you provided to L), and a subroutine reference
that will continue the PSGI application as normal (think of it as a
continuation).

=head1 SEE ALSO

L

=head1 AUTHOR

Rob Hoelz 

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2011 by Rob Hoelz.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.

=head1 BUGS

Please report any bugs or feature requests on the bugtracker website
http://github.com/hoelzro/plack-middleware-delay/issues

When submitting a bug or request, please include a test-file or a
patch to an existing test-file that illustrates the bug or desired
feature.


本源码包内暂不包含可直接显示的源代码文件,请下载源码包。