{
  "id": "06",
  "content": [
    {
      "type": "heading",
      "text": "CGI Environment & Query Parameters"
    },
    {
      "type": "text",
      "html": "Environment variables like <code>REQUEST_METHOD</code> and <code>QUERY_STRING</code> are set by the web server."
    },
    {
      "type": "text",
      "html": "Using the CGI module makes parsing easy:"
    },
    {
      "type": "text",
      "html": "<pre><code>#!/usr/bin/env perl\nuse strict; use warnings; use CGI qw(:standard);\nprint header('text/html');\nmy $name = param('name') // 'Guest';\nprint \"&lt;h1&gt;Hello, $name!&lt;/h1&gt;\";\n</code></pre>"
    }
  ],
  "quiz": {
    "questions": [
      {
        "id": "q1",
        "type": "single",
        "text": "Which environment variable carries the raw query string?",
        "options": [
          {
            "id": "a",
            "text": "QUERY_STRING"
          },
          {
            "id": "b",
            "text": "PATH_INFO"
          },
          {
            "id": "c",
            "text": "SERVER_NAME"
          }
        ],
        "correct": [
          "a"
        ]
      },
      {
        "id": "q2",
        "type": "single",
        "text": "Which CGI function retrieves a form field value?",
        "options": [
          {
            "id": "a",
            "text": "param()"
          },
          {
            "id": "b",
            "text": "field()"
          },
          {
            "id": "c",
            "text": "get()"
          }
        ],
        "correct": [
          "a"
        ]
      }
    ]
  }
}