|  line  | 
 stmt  | 
 bran  | 
 cond  | 
 sub  | 
 pod  | 
 time  | 
 code  | 
| 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 package RapidApp::Handler;  | 
| 
2
 | 
6
 | 
 
 | 
 
 | 
  
6
  
 | 
 
 | 
38
 | 
 use Moose;  | 
| 
 
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
11
 | 
    | 
| 
 
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
34
 | 
    | 
| 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
4
 | 
6
 | 
 
 | 
 
 | 
  
6
  
 | 
 
 | 
33346
 | 
 use RapidApp::Util qw(:all);  | 
| 
 
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
13
 | 
    | 
| 
 
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
3562
 | 
    | 
| 
5
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 has 'scope'		=> ( is => 'rw', default => undef, isa => 'Maybe[Object]' );  | 
| 
7
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 has 'method'	=> ( is => 'rw', default => undef, isa => 'Maybe[Str]' );  | 
| 
8
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 has 'code'		=> ( is => 'rw', default => undef, isa => 'Maybe[CodeRef]' );  | 
| 
9
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
10
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub BUILD {  | 
| 
11
 | 
1030
 | 
 
 | 
 
 | 
  
1030
  
 | 
  
0
  
 | 
1296778
 | 
 	my $self = shift;  | 
| 
12
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	  | 
| 
13
 | 
1030
 | 
  
 50
  
 | 
  
 66
  
 | 
 
 | 
 
 | 
26300
 | 
 	die 'neither code nor method supplied.' unless (defined $self->method or defined $self->code);  | 
| 
14
 | 
1030
 | 
  
 50
  
 | 
  
 66
  
 | 
 
 | 
 
 | 
20592
 | 
 	die 'method and code cannot be used together' if (defined $self->method and defined $self->code);  | 
| 
15
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	  | 
| 
16
 | 
1030
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
20383
 | 
 	if (defined $self->method) {  | 
| 
17
 | 
718
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
14343
 | 
 		die 'scope is required with method' unless (defined $self->scope);  | 
| 
18
 | 
718
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
13572
 | 
 		$self->scope->can($self->method) or die ref($self->scope) . ' does not have a method named "' . $self->method . '"';  | 
| 
19
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	}  | 
| 
20
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
21
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
22
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub call {  | 
| 
23
 | 
215
 | 
 
 | 
 
 | 
  
215
  
 | 
  
0
  
 | 
312
 | 
 	my $self = shift;  | 
| 
24
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	  | 
| 
25
 | 
215
 | 
 
 | 
 
 | 
 
 | 
 
 | 
359
 | 
 	my @args = @_;  | 
| 
26
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	  | 
| 
27
 | 
215
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
4362
 | 
 	return $self->_call_coderef(@args) if (defined $self->code);  | 
| 
28
 | 
194
 | 
 
 | 
 
 | 
 
 | 
 
 | 
3929
 | 
 	my $method = $self->method;  | 
| 
29
 | 
194
 | 
 
 | 
 
 | 
 
 | 
 
 | 
3729
 | 
 	return $self->scope->$method(@args);  | 
| 
30
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
31
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
32
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub _call_coderef {  | 
| 
33
 | 
21
 | 
 
 | 
 
 | 
  
21
  
 | 
 
 | 
47
 | 
 	my $self = shift;  | 
| 
34
 | 
21
 | 
 
 | 
 
 | 
 
 | 
 
 | 
41
 | 
 	my @arg = ();  | 
| 
35
 | 
21
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
410
 | 
 	push @arg, $self->scope if (defined $self->scope);  | 
| 
36
 | 
21
 | 
 
 | 
 
 | 
 
 | 
 
 | 
83
 | 
 	push @arg, @_;  | 
| 
37
 | 
21
 | 
 
 | 
 
 | 
 
 | 
 
 | 
442
 | 
 	return $self->code->(@arg);  | 
| 
38
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
39
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
40
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
41
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 1;  |