line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package RapidApp::Responder::InfoStatus; |
2
|
|
|
|
|
|
|
|
3
|
6
|
|
|
6
|
|
43
|
use Moose; |
|
6
|
|
|
|
|
15
|
|
|
6
|
|
|
|
|
58
|
|
4
|
|
|
|
|
|
|
extends 'RapidApp::Responder'; |
5
|
|
|
|
|
|
|
|
6
|
6
|
|
|
6
|
|
41142
|
use RapidApp::Util qw(:all); |
|
6
|
|
|
|
|
15
|
|
|
6
|
|
|
|
|
2416
|
|
7
|
6
|
|
|
6
|
|
49
|
use HTML::Entities; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
953
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# Dead simple responder that can be thrown as an excption to abort something |
11
|
|
|
|
|
|
|
# without displaying a message box. The response status can be set, and an optional |
12
|
|
|
|
|
|
|
# info message header can be set. This is useful in cases where I user cancels |
13
|
|
|
|
|
|
|
# from within customprompt logic and an exception has to be thrown to escape |
14
|
|
|
|
|
|
|
# backend business logic safely (such as during a database transaction) but |
15
|
|
|
|
|
|
|
# there is no actionable exception/message for the user. |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
has 'status', is => 'ro', isa => 'Int', default => 200; |
18
|
|
|
|
|
|
|
has 'msg', is => 'ro', isa => 'Str', default => ''; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub writeResponse { |
22
|
0
|
|
|
0
|
0
|
|
my ($self, $c)= @_; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# X-RapidApp-Info header not used yet, but it is intended to display a non-invasive status/info message |
25
|
0
|
|
|
|
|
|
$c->response->header('X-RapidApp-Info' => $self->msg); |
26
|
|
|
|
|
|
|
|
27
|
0
|
|
|
|
|
|
$c->response->status($self->status); |
28
|
0
|
|
|
|
|
|
$c->response->body(''); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
6
|
|
|
6
|
|
45
|
no Moose; |
|
6
|
|
|
|
|
31
|
|
|
6
|
|
|
|
|
37
|
|
32
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
33
|
|
|
|
|
|
|
1; |