/usr/share/perl5/Plack/Request/Upload.pm is in libplack-perl 1.0047-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | package Plack::Request::Upload;
use strict;
use warnings;
use Carp ();
sub new {
my($class, %args) = @_;
bless {
headers => $args{headers},
tempname => $args{tempname},
size => $args{size},
filename => $args{filename},
}, $class;
}
sub filename { $_[0]->{filename} }
sub headers { $_[0]->{headers} }
sub size { $_[0]->{size} }
sub tempname { $_[0]->{tempname} }
sub path { $_[0]->{tempname} }
sub content_type {
my $self = shift;
$self->{headers}->content_type(@_);
}
sub type { shift->content_type(@_) }
sub basename {
my $self = shift;
unless (defined $self->{basename}) {
require File::Spec::Unix;
my $basename = $self->{filename};
$basename =~ s|\\|/|g;
$basename = ( File::Spec::Unix->splitpath($basename) )[2];
$basename =~ s|[^\w\.-]+|_|g;
$self->{basename} = $basename;
}
$self->{basename};
}
1;
__END__
=head1 NAME
Plack::Request::Upload - handles file upload requests
=head1 SYNOPSIS
# $req is Plack::Request
my $upload = $req->uploads->{field};
$upload->size;
$upload->path;
$upload->content_type;
$upload->basename;
=head1 METHODS
=over 4
=item size
Returns the size of Uploaded file.
=item path
Returns the path to the temporary file where uploaded file is saved.
=item content_type
Returns the content type of the uploaded file.
=item filename
Returns the original filename in the client.
=item basename
Returns basename for "filename".
=back
=head1 AUTHORS
Kazuhiro Osawa
Tatsuhiko Miyagawa
=head1 SEE ALSO
L<Plack::Request>, L<Catalyst::Request::Upload>
=cut
|