Zapp::Task::Action
version 0.005
package My::Task::Action; use Mojo::Base 'Zapp::Task::Action', -signatures; sub prepare( $self, $input ) { # Notify user of input ...; # Call superclass to show input form on run page $self->SUPER::prepare( $self, $input ); } sub action( $self, $task_input, $c, $form_input ) { # Process form input return $self->SUPER::action( $task_input, $c, $form_input ); } sub run( $self, $task_input ) { my $form_input = $self->info->{notes}{input}; # Do something with input ...; # Call superclass to finish $self->SUPER::run( $c, $task_input, $form_input ); } 1; __DATA__ @@ action.html.ep %# Display form for user input
Actions are Task classes that prompt for user input and then wait. While they are waiting, Action classes may display a button, an input form, or other content on the run page.
Unlike regular Tasks, custom Actions have three steps:
The prepare step is run by a Worker. This can be extended to perform any necessary notifications or setup. Once the action is prepared, the user may see the action_field on the Run page.
The action step is run by the web application when a user interacts with the action field. The form input is stored in the input note (see "info" in Minion::Job).
input
The run step is run by the worker after the user has interacted with the action field. The default behavior is to simply finish the job successfully with the user's input. Override this for custom behavior.
Zapp::Task::Action::Confirm, Zapp::Task, Zapp
Doug Bell <preaction@cpan.org>
This software is copyright (c) 2021 by Doug Bell.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Zapp, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Zapp
CPAN shell
perl -MCPAN -e shell install Zapp
For more information on module installation, please visit the detailed CPAN module installation guide.