reduce use of CGI.pm
This commit is contained in:
@@ -17,8 +17,6 @@ sub isJson {
|
||||
}
|
||||
|
||||
sub get {
|
||||
|
||||
#get the Apache2::RequestRec
|
||||
my $r = shift;
|
||||
|
||||
my $tmp_dir = '/var/tmp/';
|
||||
@@ -31,23 +29,13 @@ sub get {
|
||||
$isJson = 0;
|
||||
|
||||
if ( defined $r ) {
|
||||
|
||||
#print STDERR "Apache2::Request\n";
|
||||
#get Apache2::Request
|
||||
my $req = Apache2::Request->new( $r, POST_MAX => $upload_limit, TEMP_DIR => $tmp_dir );
|
||||
|
||||
for my $key ( $req->param ) {
|
||||
$params->{ scalar($key) } = scalar( $req->param($key) );
|
||||
}
|
||||
|
||||
#copy params to hash
|
||||
#my $body=$req->body();
|
||||
#if (defined $body){
|
||||
# for my $key (keys %$body){
|
||||
# $params->{scalar($key)}=scalar($req->param($key));
|
||||
# }
|
||||
#}
|
||||
$status = $req->parse; #parse
|
||||
$status = $req->parse;
|
||||
} else {
|
||||
print STDERR "$0: require CGI\n";
|
||||
require "CGI.pm";
|
||||
@@ -62,14 +50,14 @@ sub get {
|
||||
$isJson = 1 if ( defined $params->{json} ) && ( $params->{json} eq '1' );
|
||||
|
||||
if ( defined $status ) {
|
||||
$status = '' if ( $status eq 'Success' );
|
||||
$status = '' if ( $status eq 'Missing input data' );
|
||||
print $cgi->header . $status . "\n" if ( $status ne '' );
|
||||
$status = '' if $status eq 'Success' ;
|
||||
$status = '' if $status eq 'Missing input data' ;
|
||||
if ($status ne ''){
|
||||
$cgi=new CGI::Simple() unless defined $cgi;
|
||||
print $cgi->header . $status . "\n";
|
||||
} ;
|
||||
}
|
||||
|
||||
#print STDERR Dumper($params);
|
||||
#print $cgi->header.Dumper($params).$status;
|
||||
|
||||
return ( $cgi, $params, $status );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user