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/Construction.pm ↑ Summary Articulate/Item/Article.pm »
1 package Articulate::Syntax::Routes;
2 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 5 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 # use Dancer qw(:syntax);
6 5 ▶use Exporter::Declare;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 5 ▶use Articulate::Service;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 5 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 5 ▶no warnings 'redefine';
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19 sub on_enable {
20 45 ▶ my $code = shift;
Subroutine on_enable: called CC=2 SCAR=6.9
Pod undocumented
21 45 my ($pkg) = caller(2);
22 45 my $routes = "${pkg}::__routes";
23 {
24 5 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
25 45 ▶ $$routes //= [];
Condition100%2/2
$$routes //= []
l!l
2520
MC/DC100%1/1
$$routes //= []
$$routes
Truth table100%2/2
A
A= $$routes
Aresult
11
00
26 45 push @$$routes, $code;
27 }
28 }
29  
30 sub _declare_route {
31 45 ▶ my ( $http_verb, $path, $code ) = @_;
Subroutine _declare_route: called CC=1 SCAR=3.1
32 on_enable(
33 sub {
34 0 ▶ my $self = shift;
Subroutine __ANON__: not called CC=1 SCAR=6.9
35 0 ▶ my $wrapped = sub { $self->serialisation->serialise( $code->(@_) ) };
Subroutine __ANON__: not called CC=1 SCAR=6.9
36 $self->framework->declare_route(
37 $http_verb => $path => sub {
38 0 ▶ perform_request( $wrapped, [ $self, $self->framework->request ] );
Subroutine __ANON__: not called CC=1 SCAR=6.9
39 }
40 0 );
41 }
42 45 );
43 }
44  
45 0 ▶sub any { _declare_route( any => @_ ); }
Subroutine any: not called CC=1 SCAR=6.9
Pod undocumented
46 15 ▶sub get { _declare_route( get => @_ ); }
Subroutine get: called CC=1 SCAR=0.0
Pod undocumented
47 30 ▶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 sub perform_request {
54 0 ▶ $_[0]->( @{ $_[1] } );
Subroutine perform_request: not called CC=1 SCAR=6.9
Pod undocumented
55 }
56  
57 5 1;
« Articulate/Construction.pm ↑ Summary Articulate/Item/Article.pm »