File Coverage

blib/lib/Telebot/Task/UpdateField.pm
Criterion Covered Total %
statement 3 13 23.0
branch 0 2 0.0
condition n/a
subroutine 1 2 50.0
pod 1 1 100.0
total 5 18 27.7


line stmt bran cond sub pod time code
1             package Telebot::Task::UpdateField;
2 1     1   2753 use Mojo::Base 'Minion::Job', -signatures;
  1         2  
  1         7  
3              
4 0     0 1   sub run ($job, $payload, $update_id) {
  0            
  0            
  0            
  0            
5 0           my $app = $job->app;
6 0 0         if (my $handler = $app->tg->handler($job->task)) {
7 0           $handler->new(
8             app => $app,
9             update_id => $update_id,
10             payload => $payload,
11             )->run;
12             }
13             else {
14 0           $job->note(warning => 'No handler for '.$job->task);
15             }
16 0           return $job->finish;
17             }
18              
19             1;
20              
21             =pod
22            
23             =encoding utf8
24              
25             =head1 NAME
26            
27             Telebot::Task::UpdateField - Minion job for processing part of update.
28              
29             =head1 SYNOPSIS
30              
31             use Telebot::Task::UpdateField;
32             $app->minion->add_task(message => 'Telebot::Task::UpdateField');
33             $app->minion->enqueue(message => [$payload, $update_id]);
34              
35             =head1 DESCRIPTION
36              
37             L is the task for processing part of incoming telegram update.
38             This task is setup in app for all allowed updates.
39              
40             =head1 ATTRIBUTES
41              
42             L inherits all attributes from L.
43              
44             =head1 METHODS
45              
46             L inherits all methods from L.
47              
48             =head2 run
49            
50             $job->run($payload, $update_id);
51              
52             This is overloaded method which determine what part of update must be processed,
53             creates instance of corresponding field handler and call handler's B
54             with payload and update_id.
55              
56             =head1 COPYRIGHT AND LICENSE
57              
58             Copyright (C) 2022, Igor Lobanov.
59             This program is free software, you can redistribute it and/or modify it under the terms of the Artistic License version
60             2.0.
61              
62             =head1 SEE ALSO
63              
64             L, L, L,
65             L.
66              
67             =cut