Catalyst-Plugin-Snippets

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

        IPC::Run::run(\@cmd, ">", sub {
            my $output = shift;
            $progress++ if ( $output =~ /made_progress/ );
        });

    then you can make use of this data to report progress to the user:

        $c->snippet( progress => $task_id => ++$progress )
            if ( $output =~ /made_progress/  );

    Meanwhile, javascript code with timers could periodically poll the
    server using an ajax request to update the progress level. To expose
    this data to the client create an action somewhere:

        sub progress : Local {
            my ( $self, $c ) = @_;
            $c->serve_snippet;
        }

    and have the client query for "/controller/progress/$task_id".

lib/Catalyst/Plugin/Snippets.pm  view on Meta::CPAN

    IPC::Run::run(\@cmd, ">", sub {
        my $output = shift;
        $progress++ if ( $output =~ /made_progress/ );
    });

then you can make use of this data to report progress to the user:

    $c->snippet( progress => $task_id => ++$progress )
        if ( $output =~ /made_progress/  );

Meanwhile, javascript code with timers could periodically poll the server using
an ajax request to update the progress level. To expose this data to the client
create an action somewhere:

    sub progress : Local {
        my ( $self, $c ) = @_;
        $c->serve_snippet;
    }

and have the client query for C<"/controller/progress/$task_id">.



( run in 0.540 second using v1.01-cache-2.11-cpan-49f99fa48dc )