| 1 | package Plack::Request::Upload; | ||||||||||
| 2 | 68 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 68 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 68 | ▶ | use Carp (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 21 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 7 | 21 | my($class, %args) = @_; | |||||||||
| 8 | |||||||||||
| 9 | bless { | ||||||||||
| 10 | headers => $args{headers}, | ||||||||||
| 11 | tempname => $args{tempname}, | ||||||||||
| 12 | size => $args{size}, | ||||||||||
| 13 | filename => $args{filename}, | ||||||||||
| 14 | 21 | }, $class; | |||||||||
| 15 | } | ||||||||||
| 16 | |||||||||||
| 17 | 3 | ▶ | sub filename { $_[0]->{filename} } | ||||||||
|
Subroutine
filename: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 18 | 0 | ▶ | sub headers { $_[0]->{headers} } | ||||||||
|
Subroutine
headers: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 19 | 1 | ▶ | sub size { $_[0]->{size} } | ||||||||
|
Subroutine
size: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 20 | 2 | ▶ | sub tempname { $_[0]->{tempname} } | ||||||||
|
Subroutine
tempname: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 21 | 7 | ▶ | sub path { $_[0]->{tempname} } | ||||||||
|
Subroutine
path: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 22 | |||||||||||
| 23 | 1 | ▶ | sub content_type { | ||||||||
|
Subroutine
content_type: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 24 | 1 | my $self = shift; | |||||||||
| 25 | 1 | $self->{headers}->content_type(@_); | |||||||||
| 26 | } | ||||||||||
| 27 | |||||||||||
| 28 | 0 | ▶ | sub type { shift->content_type(@_) } | ||||||||
|
Subroutine
type: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 29 | |||||||||||
| 30 | 12 | ▶ | sub basename { | ||||||||
|
Subroutine
basename: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||
| 31 | 12 | my $self = shift; | |||||||||
| 32 | 12 | ▶ | unless (defined $self->{basename}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 33 | 12 | require File::Spec::Unix; | |||||||||
| 34 | 12 | my $basename = $self->{filename}; | |||||||||
| 35 | 12 | $basename =~ s|\\|/|g; | |||||||||
| 36 | 12 | $basename = ( File::Spec::Unix->splitpath($basename) )[2]; | |||||||||
| 37 | 12 | $basename =~ s|[^\w\.-]+|_|g; | |||||||||
| 38 | # never return an empty name or a directory reference | ||||||||||
| 39 | 12 | ▶ | $basename = '_' if $basename =~ /^\.{0,2}\z/; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 40 | 12 | $self->{basename} = $basename; | |||||||||
| 41 | } | ||||||||||
| 42 | 12 | $self->{basename}; | |||||||||
| 43 | } | ||||||||||
| 44 | |||||||||||
| 45 | 68 | 1; | |||||||||
| 46 | __END__ | ||||||||||