in reply to Re^2: %ENV is returning a blank
in thread %ENV is returning a blank

Sorry, I posted the above in a hurry before I went to work, I therefore got the post and get methods mixed. I have tried both, post and get, and both give me empty data back.

Instead of your program, try something like this instead

#!/usr/bin/perl -- use strict; use warnings; use CGI; use Data::Dumper; #zum debuggen Main( @ARGV ); exit( 0 ); sub Main { my $cgi = CGI->new; print $cgi->header(); # Write HTTP header print $cgi->start_html, $cgi->b(rand time, ' ', scalar gmtime), '<table border="1" width="%100"><tr><td>', $cgi->Dump, '</td><td><div style="white-space: pre-wrap; overflow: scroll;">', $cgi->escapeHTML( Dumper( $cgi ) ), '</div></td></tr></table>', CGI->new( \%ENV )->Dump, $cgi->end_html; }

Reading the manual is fundamental

Replies are listed 'Best First'.
Re^4: %ENV is returning a blank
by irvy (Initiate) on Aug 19, 2011 at 07:22 UTC
    Hello, thank you for your quick response. I did try your script. It is giving me output on all the ENV variables, however the QUERY_STRING is still blank. The 'params' is empty. Could it be possible that I need to set up something else on the server? Irwin

      Could it be possible that I need to set up something else on the server

      Can't say, never heard of a webserver that would execute cgis, but then fail to set the required ENV vars ... but all we've got is your word that something is wrong, and for all we know, you're looking at the wrong thing :/

        Below is the output from your script. Please tell me if I am looking at the wrong thing.

        1019851644.86502 Fri Aug 19 07:46:53 2011

        $VAR1 = bless( { '.parameters' => [], 'use_tempfile' => 1, '.etab' => 1, '.charset' => 'ISO-8859-1', '.fieldnames' => {}, '.elid' => 1, 'param' => {}, 'escape' => 1, '.header_printed' => 1 }, 'CGI' );

        SCRIPT_NAME /cgi-bin/test.pl SERVER_NAME irvy.com.au HTTP_REFERER http://irvy.com.au/makeBooking.xml SERVER_ADMIN webmaster@irvy.com.au HTTP_ACCEPT_ENCODING gzip,deflate,sdch HTTP_CONNECTION keep-alive REQUEST_METHOD GET HTTP_ACCEPT text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 SCRIPT_FILENAME /home/irvy1607/public_html/cgi-bin/test.pl SERVER_SOFTWARE Apache HTTP_ACCEPT_CHARSET ISO-8859-1,utf-8;q=0.7,*;q=0.3 QUERY_STRING REMOTE_PORT 46728 HTTP_USER_AGENT Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.112 Safari/535.1 SERVER_PORT 80 SERVER_SIGNATURE HTTP_ACCEPT_LANGUAGE en-US,en;q=0.8 HTTP_COOKIE cpsession=irvy16076162218125107012768877432565436767357127847170640561398598858064; logintheme=cpanel; langedit=; lang=; cprelogin=no REMOTE_ADDR 115.70.36.80 SERVER_PROTOCOL HTTP/1.1 PATH /usr/local/bin:/usr/bin:/bin REQUEST_URI /cgi-bin/test.pl? GATEWAY_INTERFACE CGI/1.1 SERVER_ADDR 76.74.128.190 DOCUMENT_ROOT /home/irvy1607/public_html HTTP_HOST irvy.com.au UNIQUE_ID Tk4U7UxKgL4AAEejcWcAAAAb