Filename | /usr/local/share/perl/5.18.2/Plack/Request/Upload.pm |
Statements | Executed 7 statements in 262µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 9µs | 18µs | BEGIN@2 | Plack::Request::Upload::
1 | 1 | 1 | 8µs | 16µs | BEGIN@3 | Plack::Request::Upload::
1 | 1 | 1 | 3µs | 3µs | BEGIN@4 | Plack::Request::Upload::
0 | 0 | 0 | 0s | 0s | basename | Plack::Request::Upload::
0 | 0 | 0 | 0s | 0s | content_type | Plack::Request::Upload::
0 | 0 | 0 | 0s | 0s | filename | Plack::Request::Upload::
0 | 0 | 0 | 0s | 0s | headers | Plack::Request::Upload::
0 | 0 | 0 | 0s | 0s | new | Plack::Request::Upload::
0 | 0 | 0 | 0s | 0s | path | Plack::Request::Upload::
0 | 0 | 0 | 0s | 0s | size | Plack::Request::Upload::
0 | 0 | 0 | 0s | 0s | tempname | Plack::Request::Upload::
0 | 0 | 0 | 0s | 0s | type | Plack::Request::Upload::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package Plack::Request::Upload; | ||||
2 | 2 | 20µs | 2 | 27µs | # spent 18µs (9+9) within Plack::Request::Upload::BEGIN@2 which was called:
# once (9µs+9µs) by Plack::Request::BEGIN@12 at line 2 # spent 18µs making 1 call to Plack::Request::Upload::BEGIN@2
# spent 9µs making 1 call to strict::import |
3 | 2 | 18µs | 2 | 24µs | # spent 16µs (8+8) within Plack::Request::Upload::BEGIN@3 which was called:
# once (8µs+8µs) by Plack::Request::BEGIN@12 at line 3 # spent 16µs making 1 call to Plack::Request::Upload::BEGIN@3
# spent 8µs making 1 call to warnings::import |
4 | 2 | 223µs | 1 | 3µs | # spent 3µs within Plack::Request::Upload::BEGIN@4 which was called:
# once (3µs+0s) by Plack::Request::BEGIN@12 at line 4 # spent 3µs making 1 call to Plack::Request::Upload::BEGIN@4 |
5 | |||||
6 | sub new { | ||||
7 | my($class, %args) = @_; | ||||
8 | |||||
9 | bless { | ||||
10 | headers => $args{headers}, | ||||
11 | tempname => $args{tempname}, | ||||
12 | size => $args{size}, | ||||
13 | filename => $args{filename}, | ||||
14 | }, $class; | ||||
15 | } | ||||
16 | |||||
17 | sub filename { $_[0]->{filename} } | ||||
18 | sub headers { $_[0]->{headers} } | ||||
19 | sub size { $_[0]->{size} } | ||||
20 | sub tempname { $_[0]->{tempname} } | ||||
21 | sub path { $_[0]->{tempname} } | ||||
22 | |||||
23 | sub content_type { | ||||
24 | my $self = shift; | ||||
25 | $self->{headers}->content_type(@_); | ||||
26 | } | ||||
27 | |||||
28 | sub type { shift->content_type(@_) } | ||||
29 | |||||
30 | sub basename { | ||||
31 | my $self = shift; | ||||
32 | unless (defined $self->{basename}) { | ||||
33 | require File::Spec::Unix; | ||||
34 | my $basename = $self->{filename}; | ||||
35 | $basename =~ s|\\|/|g; | ||||
36 | $basename = ( File::Spec::Unix->splitpath($basename) )[2]; | ||||
37 | $basename =~ s|[^\w\.-]+|_|g; | ||||
38 | $self->{basename} = $basename; | ||||
39 | } | ||||
40 | $self->{basename}; | ||||
41 | } | ||||
42 | |||||
43 | 1 | 2µs | 1; | ||
44 | __END__ |