Mercurial > pub > Impl
comparison Lib/IMPL/Web/Application.pm @ 138:c5bc900eefd3
IMPL::Web::Application: Fixed file uploading
Minor improvements in the IMPL::Web::TT::Form
author | wizard |
---|---|
date | Thu, 01 Jul 2010 04:25:07 +0400 |
parents | 06a34c197b05 |
children | 4267a2ac3d46 |
comparison
equal
deleted
inserted
replaced
137:6975cd4973d1 | 138:c5bc900eefd3 |
---|---|
97 package CGIWrapper; | 97 package CGIWrapper; |
98 use base qw(CGI); | 98 use base qw(CGI); |
99 | 99 |
100 use Encode; | 100 use Encode; |
101 | 101 |
102 our $NO_DECODE = 0; | |
103 | |
102 sub param { | 104 sub param { |
103 my $this = shift; | 105 my $this = shift; |
106 | |
107 return $this->SUPER::param(@_) if $NO_DECODE; | |
104 | 108 |
105 if (wantarray) { | 109 if (wantarray) { |
106 my @result = $this->SUPER::param(@_); | 110 my @result = $this->SUPER::param(@_); |
107 | 111 |
108 return map Encode::is_utf8($_) ? $_ : Encode::decode($this->charset,$_,Encode::LEAVE_SRC), @result; | 112 return map Encode::is_utf8($_) ? $_ : Encode::decode($this->charset,$_,Encode::LEAVE_SRC), @result; |
110 my $result = $this->SUPER::param(@_); | 114 my $result = $this->SUPER::param(@_); |
111 | 115 |
112 return Encode::is_utf8($result) ? $result : Encode::decode($this->charset,$result,Encode::LEAVE_SRC); | 116 return Encode::is_utf8($result) ? $result : Encode::decode($this->charset,$result,Encode::LEAVE_SRC); |
113 } | 117 } |
114 | 118 |
119 } | |
120 | |
121 sub upload { | |
122 my $this = shift; | |
123 | |
124 local $NO_DECODE = 1; | |
125 my $oldCharset = $this->charset(); | |
126 $this->charset('ISO-8859-1'); | |
127 | |
128 my $fh = $this->SUPER::upload(@_); | |
129 | |
130 $this->charset($oldCharset); | |
131 return $fh; | |
115 } | 132 } |
116 | 133 |
117 1; | 134 1; |
118 | 135 |
119 __END__ | 136 __END__ |