The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Eidolon::Core::CGI - common gateway interface functions for Eidolon.

SYNOPSIS

    use Eidolon::Core::CGI;

DESCRIPTION

The Eidolon::Core::CGI class provides standard CGI functions - GET/POST requests parsing, cookies & session handling. It's more comfortable and fast replacement of old CGI package.

METHODS

new()

Class constructor. Creates an object and calls the initialization function.

decode_string($string)

Decodes an url-encoded $string.

get($name)

Returns a value of the GET parameter. If $name of variable is not given, returns a hashref with all GET parameters.

post($name)

Returns a value of the POST parameter. If $name of variable is not given, returns a hashref with all POST parameters.

get_query()

Returns a cleaned query string.

get_file($name)

Returns a hashref with uploaded file data:

  • name

    Uploaded file name.

  • tmp

    Path to temporary file, where uploaded file contents are stored. This file is automatically deleted during Eidolon::Core::CGI object destruction, so you don't need to care about this.

  • ext

    Uploaded file extension.

If $name of parameter is not given, returns a hashref with all uploaded files.

receive_file($name)

Returns contents of the uploaded file. $name - name of upload variable.

get_param($name)

Returns a value of the GET or POST parameter with the given $name. If variable $name exists both in GET and POST requests, value will be taken from first.

get_cookie($name)

Returns a cookie value.

set_cookie($name, $value, $expires, $path, $domain)

Sets a cookie. $expires - is a number of seconds in which the cookie will be expired.

generate_string($len)

Returns a randomly-generated string with. $len - length of the string to be generated. If $len is not specified, 32-character string will be generated.

start_session()

Initialize user session. Generates a magic session ID and sets a cookie with this value to user.

destroy_session()

Destroys the session, if any.

session_started()

Checks if session was started.

set_session($key, $value)

Sets session parameter $key with the given $value.

get_session($key)

Returns $key session parameter value.

header_sent()

Checks if HTTP header is already sent. Returns 1 or 0.

add_header($header)

Adds user-defined header string $header.

redirect($to)

Sends a redirect header to web browser.

send_header()

Sends HTTP header to browser.

SEE ALSO

Eidolon, CGI

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR

Anton Belousov, <abel@cpan.org>

COPYRIGHT

Copyright (c) 2009, Atma 7, http://www.atma7.com