Can CGI have different environment variables than the default environment variables provided by the server?

Yes and no. Depends on what you mean by different. As a whole, the lists of environment variables are different. Some variables are common to both, while others are unique.

#!/usr/bin/perl -w use strict; use warnings; my $i = 1; for (sort keys %ENV){ print "$i $_\n"; $i++; }


On my current system these environment varibles were specific to the command line:
APPDATA HOMEDRIVE HOMEPATH LOGONSERVER PROMPT SESSIONNAME SWIFT_TRACE SYSTEMDRIVE SYSTEMROOT TEMP TMP USERDNSDOMAIN USERDOMAIN USERNAME USERPROFILE VS90COMNTOOLS WF_RESOURCES WINDIR

And these were specific to the webserver:

CONTENT_LENGTH GATEWAY_INTERFACE HTTPS HTTP_ACCEPT HTTP_ACCEPT_ENCODING HTTP_ACCEPT_LANGUAGE HTTP_CONNECTION HTTP_HOST HTTP_USER_AGENT INSTANCE_ID LOCAL_ADDR PATH_INFO PATH_TRANSLATED REMOTE_ADDR REMOTE_HOST REQUEST_METHOD SCRIPT_NAME SERVER_NAME SERVER_PORT SERVER_PORT_SECURE SERVER_PROTOCOL SERVER_SOFTWARE

And these are common to both:
ALLIANCE ALLUSERSPROFILE ARCH COMMONPROGRAMFILES COMPUTERNAME COMSPEC CSYS_DCE_CLIENT_PROT CVSROOT DCE_CLIENT_PROT DCE_SERVER_PROT ERRLOG_CATALOG_DIR FP_NO_HOST_CHECK NUMBER_OF_PROCESSORS OAPI_TRACE OAPI_TRACE_INSTANT_FLUSH OS PATH PATHEXT PROCESSOR_ARCHITECTURE PROCESSOR_IDENTIFIER PROCESSOR_LEVEL PROCESSOR_REVISION PROGRAMFILES

In reply to Re: Can CGI have different environment variables than the default environment variables provided by the server ? by desemondo
in thread Can CGI have different environment variables than the default environment variables provided by the server ? by manishrathi

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.