line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Articulate::Syntax::Routes; |
2
|
6
|
|
|
6
|
|
29
|
use strict; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
239
|
|
3
|
6
|
|
|
6
|
|
28
|
use warnings; |
|
6
|
|
|
|
|
8
|
|
|
6
|
|
|
|
|
132
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# use Dancer qw(:syntax); |
6
|
6
|
|
|
6
|
|
29
|
use Exporter::Declare; |
|
6
|
|
|
|
|
9
|
|
|
6
|
|
|
|
|
1021
|
|
7
|
6
|
|
|
6
|
|
7335
|
use Articulate::Service; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
40
|
|
8
|
|
|
|
|
|
|
default_exports qw( |
9
|
|
|
|
|
|
|
any get post patch del put options |
10
|
|
|
|
|
|
|
); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# request upload uploads captures param params splat |
13
|
|
|
|
|
|
|
# config var session template |
14
|
|
|
|
|
|
|
# redirect forward halt pass send_error status |
15
|
|
|
|
|
|
|
# ); # the first line will stay, everything else will find its way into framework |
16
|
|
|
|
|
|
|
|
17
|
6
|
|
|
6
|
|
1732
|
no warnings 'redefine'; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
500
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub on_enable { |
20
|
54
|
|
|
54
|
0
|
67
|
my $code = shift; |
21
|
54
|
|
|
|
|
234
|
my ($pkg) = caller(2); |
22
|
54
|
|
|
|
|
219
|
my $routes = "${pkg}::__routes"; |
23
|
|
|
|
|
|
|
{ |
24
|
6
|
|
|
6
|
|
27
|
no strict 'refs'; |
|
6
|
|
|
|
|
9
|
|
|
6
|
|
|
|
|
1889
|
|
|
54
|
|
|
|
|
54
|
|
25
|
54
|
|
100
|
|
|
265
|
$$routes //= []; |
26
|
54
|
|
|
|
|
225
|
push @$$routes, $code; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub _declare_route { |
31
|
54
|
|
|
54
|
|
79
|
my ( $http_verb, $path, $code ) = @_; |
32
|
|
|
|
|
|
|
on_enable( |
33
|
|
|
|
|
|
|
sub { |
34
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
35
|
0
|
|
|
|
|
0
|
my $wrapped = sub { $self->serialisation->serialise( $code->(@_) ) }; |
|
0
|
|
|
|
|
0
|
|
36
|
|
|
|
|
|
|
$self->framework->declare_route( |
37
|
|
|
|
|
|
|
$http_verb => $path => sub { |
38
|
0
|
|
|
|
|
0
|
perform_request( $wrapped, [ $self, $self->framework->request ] ); |
39
|
|
|
|
|
|
|
} |
40
|
0
|
|
|
|
|
0
|
); |
41
|
|
|
|
|
|
|
} |
42
|
54
|
|
|
|
|
225
|
); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
0
|
|
|
0
|
0
|
0
|
sub any { _declare_route( any => @_ ); } |
46
|
18
|
|
|
18
|
0
|
48
|
sub get { _declare_route( get => @_ ); } |
47
|
36
|
|
|
36
|
0
|
101
|
sub post { _declare_route( post => @_ ); } |
48
|
0
|
|
|
0
|
0
|
|
sub patch { _declare_route( patch => @_ ); } |
49
|
0
|
|
|
0
|
0
|
|
sub del { _declare_route( del => @_ ); } |
50
|
0
|
|
|
0
|
0
|
|
sub put { _declare_route( put => @_ ); } |
51
|
0
|
|
|
0
|
0
|
|
sub options { _declare_route( options => @_ ); } |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub perform_request { |
54
|
0
|
|
|
0
|
0
|
|
$_[0]->( @{ $_[1] } ); |
|
0
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
1; |