PAD/Plugin.pm

filter: Statementstmt 40.6% 13 / 32 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 40.0% 4 / 10 Podpod 83.3% 5 / 6 totaltotal 39.2% 22 / 56 CC 5 SCAR 24.6
CC
5
Cov
32%
relative_path
30.0
new
2.0
suffix
2.0
CRAP 11.7
↑ Summary PAD/Plugin/Markdown.pm »
1 package PAD::Plugin;
2 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use Carp ();
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use File::Spec::Unix;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
Pod undocumented
8 0 my ($class, %args) = @_;
9 0 bless { %args }, $class;
10 }
11  
12 0 ▶sub suffix { qr/.+/ }
Subroutine suffix: not called CC=1 SCAR=6.9
Pod documented
13 0 ▶sub content_type { 'text/plain; charset=UTF-8' }
Subroutine content_type: not called CC=1 SCAR=6.9
Pod documented
14  
15 0 ▶sub request { shift->{request} }
Subroutine request: not called CC=1 SCAR=6.9
Pod documented
16 0 ▶sub relative_path { # extracted from Plack::App::File :)
Subroutine relative_path: not called CC=5 SCAR=34.0
Pod documented
17 0 my $self = shift;
18 0 my $path = $self->request->path_info;
19  
20 0 ▶ if ($path =~ /\0/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($path =~ /\0/) 0 0 0
21 0 Carp::croak "Bad Request";
22 }
23  
24 0 my @path = split '/', $path;
25 0 ▶ if (@path) {
Branch: 1 branch
BranchTrueFalseTotal
if (@path) { } 0 0 0
26 0 ▶ if ($path[0] eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($path[0] eq "") 0 0 0
27 shift @path
28 0 }
29  
30 } else {
31 0 @path = '.';
32 }
33  
34 0 ▶ if (grep { $_ eq '..' } @path) {
Branch: 1 branch
BranchTrueFalseTotal
if (grep {$_ eq "..";} @path) 0 0 0
35 0 Carp::croak "Forbidden";
36 }
37  
38 0 File::Spec::Unix->catfile('.', @path);
39 }
40  
41 0 ▶sub execute { shift->request->new_response(501)->finalize }
Subroutine execute: not called CC=1 SCAR=6.9
Pod documented
42  
43 3 1;
44 __END__
↑ Summary PAD/Plugin/Markdown.pm »