Mojolicious-Plugin-AutoReload

 view release on metacpan or  search on metacpan

lib/Mojolicious/Plugin/AutoReload.pm  view on Meta::CPAN

            # Using a around_dispatch hook allows us to avoid logging
            # anything or doing anything when polling. This way we can
            # poll faster without making debugging harder.
            my ( $next, $c ) = @_;
            return $next->() if $c->req->url->path ne '/auto_reload'
                || $c->req->is_handshake;
            # Prevent Mojolicious from doing anything else with this
            # request.
            $c->stash( 'mojo.finished', 1 );
            $c->render_later;
            # Client is just looking for a response, but validate their
            # nonce first.
            if ( !$c->param( 'nonce' ) || $c->param( 'nonce' ) ne $nonce ) {
                return $c->rendered( 205 );
            }
            return $c->rendered( 204 );
        } );

        $app->hook(after_render => sub {
            my ( $c, $output, $format ) = @_;
            return if $c->stash( 'plugin.auto_reload.disable' );



( run in 1.020 second using v1.01-cache-2.11-cpan-39bf76dae61 )