line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Blosxom::Plugin::Web::Request::Upload; |
2
|
2
|
|
|
2
|
|
1392
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
79
|
|
3
|
2
|
|
|
2
|
|
24
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
61
|
|
4
|
2
|
|
|
2
|
|
10
|
use File::Spec::Unix; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
945
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub new { |
7
|
5
|
|
|
5
|
0
|
763
|
my ( $class, %args ) = @_; |
8
|
|
|
|
|
|
|
|
9
|
5
|
|
|
|
|
7
|
my %header; |
10
|
5
|
50
|
|
|
|
17
|
if ( my $header = delete $args{header} ) { |
11
|
5
|
|
|
|
|
6
|
my @fields = map { lc } keys %{ $header }; |
|
14
|
|
|
|
|
32
|
|
|
5
|
|
|
|
|
15
|
|
12
|
5
|
|
|
|
|
9
|
@header{ @fields } = values %{ $header }; |
|
5
|
|
|
|
|
27
|
|
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
5
|
|
|
|
|
18
|
my %self = ( |
16
|
|
|
|
|
|
|
header => \%header, |
17
|
|
|
|
|
|
|
fh => delete $args{fh}, |
18
|
|
|
|
|
|
|
path => delete $args{path}, |
19
|
|
|
|
|
|
|
); |
20
|
|
|
|
|
|
|
|
21
|
5
|
|
|
|
|
25
|
bless \%self, $class; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
0
|
|
|
0
|
1
|
0
|
sub path { shift->{path} } |
25
|
|
|
|
|
|
|
|
26
|
3
|
|
|
3
|
1
|
11209
|
sub fh { $_[0]->{fh} } |
27
|
1
|
|
|
1
|
1
|
20
|
sub size { -s $_[0]->{fh} } |
28
|
4
|
|
|
4
|
1
|
498
|
sub filename { "$_[0]->{fh}" } |
29
|
|
|
|
|
|
|
|
30
|
1
|
|
|
1
|
1
|
16
|
sub content_type { shift->{header}->{'content-type'} } |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub header { |
33
|
0
|
|
|
0
|
1
|
0
|
my ( $self, $field ) = @_; |
34
|
0
|
|
|
|
|
0
|
$field =~ tr/_A-Z/-a-z/; |
35
|
0
|
|
|
|
|
0
|
$self->{header}->{$field}; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub basename { |
39
|
1
|
|
|
1
|
1
|
564
|
my $self = shift; |
40
|
1
|
|
|
|
|
3
|
( my $basename = $self->filename ) =~ s{\\}{/}g; |
41
|
1
|
|
|
|
|
32
|
$basename = ( File::Spec::Unix->splitpath($basename) )[2]; |
42
|
1
|
|
|
|
|
3
|
$basename =~ s{[^\w\.-]+}{_}g; |
43
|
1
|
|
|
|
|
14
|
$basename; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
package Fh; # See CGI.pm |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub file { |
49
|
1
|
|
|
1
|
|
926
|
require IO::File; |
50
|
1
|
|
|
|
|
2493
|
IO::File->new_from_fd( fileno $_[0], '<' ); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
1; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
__END__ |