Articulate/Syntax/Routes.pm

filter: Statementstmt 71.4% 30 / 42 Branchbran n/a Conditioncond 100% 2 / 2 MC/DCmcdc 100% 1 / 1 Subroutinesub 52.6% 10 / 19 Podpod 0.0% 0 / 9 totaltotal 58.9% 43 / 73 CC 2 SCAR 4.5
CC
2
Cov
73%
on_enable
2.0
__ANON__
2.0
__ANON__
2.0
CRAP 1.6
« Articulate/Error.pm ↑ Summary Articulate/Item/Article.pm »
1 package Articulate::Syntax::Routes;
2 6 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 6 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 # use Dancer qw(:syntax);
6 6 ▶use Exporter::Declare;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 6 ▶use Articulate::Service;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 6 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 ▶no warnings 'redefine';
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19 54 ▶sub on_enable {
Subroutine on_enable: called CC=2 SCAR=6.9
Pod undocumented
20 54 my $code = shift;
21 54 my ($pkg) = caller(2);
22 54 my $routes = "${pkg}::__routes";
23 {
24 6 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
25 54 ▶ $$routes //= [];
Condition100%2/2
$$routes //= []
l!l
3024
MC/DC100%1/1
$$routes //= []
$$routes
Truth table100%2/2
A
A= $$routes
Aresult
11
00
26 54 push @$$routes, $code;
27 }
28 }
29  
30 54 ▶sub _declare_route {
Subroutine _declare_route: called CC=1 SCAR=3.1
31 54 my ( $http_verb, $path, $code ) = @_;
32 on_enable(
33 0 ▶ sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
34 0 my $self = shift;
35 0 ▶ my $wrapped = sub { $self->serialisation->serialise( $code->(@_) ) };
Subroutine __ANON__: not called CC=1 SCAR=6.9
36 $self->framework->declare_route(
37 0 ▶ $http_verb => $path => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
38 0 perform_request( $wrapped, [ $self, $self->framework->request ] );
39 }
40 0 );
41 }
42 54 );
43 }
44  
45 0 ▶sub any { _declare_route( any => @_ ); }
Subroutine any: not called CC=1 SCAR=6.9
Pod undocumented
46 18 ▶sub get { _declare_route( get => @_ ); }
Subroutine get: called CC=1 SCAR=0.0
Pod undocumented
47 36 ▶sub post { _declare_route( post => @_ ); }
Subroutine post: called CC=1 SCAR=0.0
Pod undocumented
48 0 ▶sub patch { _declare_route( patch => @_ ); }
Subroutine patch: not called CC=1 SCAR=6.9
Pod undocumented
49 0 ▶sub del { _declare_route( del => @_ ); }
Subroutine del: not called CC=1 SCAR=6.9
Pod undocumented
50 0 ▶sub put { _declare_route( put => @_ ); }
Subroutine put: not called CC=1 SCAR=6.9
Pod undocumented
51 0 ▶sub options { _declare_route( options => @_ ); }
Subroutine options: not called CC=1 SCAR=6.9
Pod undocumented
52  
53 0 ▶sub perform_request {
Subroutine perform_request: not called CC=1 SCAR=6.9
Pod undocumented
54 0 $_[0]->( @{ $_[1] } );
55 }
56  
57 6 1;
« Articulate/Error.pm ↑ Summary Articulate/Item/Article.pm »