CGI::WebIn - Perl extension for reading CGI form data

- NAME
- SYNOPSIS
- FEATURES
- OVERVIEW
- DESCRIPTION
- AUTHOR
- SEE ALSO

# NAME

CGI::WebIn - Perl extension for reading CGI form data

# SYNOPSIS

      use CGI::WebOut;
      use CGI::WebIn(1);

      # just to avoid "typo warning"
      our ($doGo,%Address,$Count);

      # count visits
      SetCookie("Count",++$Count,"+10y");

      # is the button pressed?
      if($doGo) {
          print "Hello from $Address{Russia}{Moscow}!";
      }

      print <<EOT;
        You have visited this page $Count times.
        <form action=$SCRIPT_NAME method=post enctype=multipart/form-data>
        <input type=text name="Address{Russia}{Moscow}" value="house">
        <input type=submit name=doGo value="Say hello">
        </form>
      EOT

# FEATURES

- Handle multi-dimentional GET/POST form data (see SYNOPSIS).

- Handle multipart forms for file uploads.

- Full real-time multi-dimentional cookie support.

- PHP-style form data exporting.

- Fast URL encode/decode subroutines.

# OVERVIEW

This module is used to make CGI programmer's work more comfortable. The main idea is to handle input stream (`STDIN`) and `QUERY_STRING` environment variable sent by browser and parse their correctly (including multipart forms). Resulting variables are put to `%GET`, `%POST`, `%COOKIES` and `%IN` (`%IN` holds ALL the data). Also allows you to get/set cookies (any structure, not only scalars!) with `SetCookie()` subroutine.

If this module is included without any arguments:

      use CGI::WebIn;

it exports the following: `%IN`, `%GET`, `%POST`, `%COOKIES`, `SetCookie()` and `DropCookie()`

You can specify additional information to be exported by using include arguments:

      use CGI::WebIn 'gpce';

means that all the GET, POST, Cookies and then environment variables will be exported to ``usual'' package variables. You must not be afraid to write everywhere `'gpce'` - the following instruction does the same:

      use CGI::WebIn 'gpce';

# DESCRIPTION

`use CGI::WebIn(1)`
  Reads all the CGI input and exports it to the caller module (like PHP does).

`%IN, %GET, %POST and %COOKIES`
  `%IN` contains all the form data. `%GET`, `%POST` and `%COOKIES` holds GET, POST and Cookies variables respectively.

`void SetCookie($name, $value [,int $expire][,$path][,$domain][bool $secure])`
  Sets the cookie in user browser. Value of that cookie is placed to `%COOKIES` and ALL exported client modules immediately. Format for time `$expire` can be in any of the forms:

        <stamp> - UNIX timestamp
        0       - one-session cookie
        undef   - drop this cookie
        "now"   - expire immediately
        "+180s" - in 180 seconds
        "+2m"   - in 2 minutes
        "+12h"  - in 12 hours
        "+1d"   - in 1 day
        "+3M"   - in 3 months
        "+2y"   - in 2 years
        "-3m"   - 3 minutes ago(!)

`void DropCookie(string $name [,string $path] [,string $domain])`
  Destroys the specified cookie. Make sure the `$path` and `$domain` parameters are the same to previous `SetCookie()` call.

`file uploading support`
  To enable file uploading, you must create the following file `.can_upload`:

        # directory to upload user files
        dir = .
        # maximum allowed size of the file to upload
        maxsize = 100000

  and place it to the current directory. If there is no `.can_upload` file, uploading is disabled.

# AUTHOR

Dmitry Koteroff <dk@dklab.ru>, http://www.dklab.ru

# SEE ALSO

`CGI::WebOut`.