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 SCAR 7.3
CC
2
Cov
73%
on_enable
2.0
__ANON__
2.0
__ANON__
2.0
CRAP 2.1
« Articulate/Item.pm ↑ Summary Articulate/Permission.pm »
1 package Articulate::Syntax::Routes;
2 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 # use Dancer qw(:syntax);
5 4 ▶use Exporter::Declare;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 4 ▶use Articulate::Service;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 4 default_exports qw(
8 any get post patch del put options
9 );
10 # request upload uploads captures param params splat
11 # config var session template
12 # redirect forward halt pass send_error status
13 # ); # the first line will stay, everything else will find its way into framework
14  
15 4 ▶no warnings 'redefine';
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 sub on_enable {
18 36 ▶ my $code = shift;
Subroutine on_enable: called CC=2 SCAR=6.9
Pod undocumented
19 36 my ($pkg) = caller(2);
20 36 my $routes = "${pkg}::__routes";
21 {
22 4 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
23 36 ▶ $$routes //= [];
Condition100%2/2
$$routes //= []
l!l
2016
MC/DC100%1/1
$$routes //= []
$$routes
Truth table100%2/2
A
A= $$routes
Aresult
11
00
24 36 push @$$routes, $code;
25 }
26 }
27  
28 sub _declare_route {
29 36 ▶ my ( $http_verb, $path, $code ) = @_;
Subroutine _declare_route: called CC=1 SCAR=3.1
30 on_enable ( sub {
31 0 ▶ my $self = shift;
Subroutine __ANON__: not called CC=1 SCAR=6.9
32 0 ▶ my $wrapped = sub{ $self->serialisation->serialise( $code->( @_ ) ) };
Subroutine __ANON__: not called CC=1 SCAR=6.9
33 0 ▶ $self->framework->declare_route( $http_verb => $path => sub { perform_request( $wrapped, [ $self, $self->framework->request ] ) } );
Subroutine __ANON__: not called CC=1 SCAR=6.9
34 36 } );
35 }
36  
37 0 ▶sub any { _declare_route ( any => @_ ); }
Subroutine any: not called CC=1 SCAR=6.9
Pod undocumented
38 12 ▶sub get { _declare_route ( get => @_ ); }
Subroutine get: called CC=1 SCAR=0.0
Pod undocumented
39 24 ▶sub post { _declare_route ( post => @_ ); }
Subroutine post: called CC=1 SCAR=0.0
Pod undocumented
40 0 ▶sub patch { _declare_route ( patch => @_ ); }
Subroutine patch: not called CC=1 SCAR=6.9
Pod undocumented
41 0 ▶sub del { _declare_route ( del => @_ ); }
Subroutine del: not called CC=1 SCAR=6.9
Pod undocumented
42 0 ▶sub put { _declare_route ( put => @_ ); }
Subroutine put: not called CC=1 SCAR=6.9
Pod undocumented
43 0 ▶sub options { _declare_route ( options => @_ ); }
Subroutine options: not called CC=1 SCAR=6.9
Pod undocumented
44  
45  
46 sub perform_request {
47 0 ▶ $_[0]->(@{ $_[1] });
Subroutine perform_request: not called CC=1 SCAR=6.9
Pod undocumented
48 }
49  
50 4 1;
« Articulate/Item.pm ↑ Summary Articulate/Permission.pm »