don't decode filenames
[bse.git] / site / cgi-bin / modules / BSE / CGI.pm
CommitLineData
3f9c8a96
TC
1package BSE::CGI;
2use strict;
3use Encode;
4
b3d836c6 5our $VERSION = "1.001";
cb7fd78d 6
3f9c8a96
TC
7sub new {
8 my ($class, $q, $charset) = @_;
9
10 my $self = bless
11 {
12 cgi => $q,
13 charset => $charset,
14 }, $class;
15
16 return $self;
17}
18
19sub param {
20 my ($self, @args) = @_;
21
22 my @result = $self->{cgi}->param(@args)
23 or return;
24 for my $value (@result) {
b3d836c6
TC
25 $value = decode($self->{charset}, $value)
26 unless ref $value;
3f9c8a96
TC
27 }
28
29 return wantarray && @result > 1 ? @result : $result[0];
30}
31
32sub upload {
33 my ($self, @args) = @_;
34
35 return $self->{cgi}->upload(@args);
36}
37
38sub uploadInfo {
39 my ($self, @args) = @_;
40
41 return $self->{cgi}->uploadInfo(@args);
42}
43
441;
45
46=head1 NAME
47
48BSE::CGI - CGI.pm wrapper that does character set conversions to perl's internal encoding
49
50=head1 SYNOPSIS
51
52 my $cgi1 = CGI->new;
53 my $cgi = BSE::CGI->new($cgi1, $charset);
54
55=head1 DESCRIPTION
56
57Only provides param(), upload() and uploadInfo().
58
59=cut