| 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
| |||||||||||
| 21 | 0 | Carp::croak "Bad Request"; | |||||||||
| 22 | } | ||||||||||
| 23 | |||||||||||
| 24 | 0 | my @path = split '/', $path; | |||||||||
| 25 | 0 | ▶ | if (@path) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 26 | 0 | ▶ | if ($path[0] eq '') { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 27 | shift @path | ||||||||||
| 28 | 0 | } | |||||||||
| 29 | |||||||||||
| 30 | } else { | ||||||||||
| 31 | 0 | @path = '.'; | |||||||||
| 32 | } | ||||||||||
| 33 | |||||||||||
| 34 | 0 | ▶ | if (grep { $_ eq '..' } @path) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 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__ | ||||||||||