Next:
Text::Wigwam::Modules::Core::Html
Previous:
Text::Wigwam::Library::Time
 [Table of Contents][Text::Wigwam Index]

Text::Wigwam::Modules::Core::Cgi



NAME

Text::Wigwam::Modules::Core::Cgi #cgi::encode, #cgi::decode, #cgi::post, #cgi::env, #cgi::get_query, #cgi::parse_query, #cgi::make_query #cgi::parse_cookies #cgi::make_cookies

Description

This module contains directives useful for accessing CGI environment variables, and managing query strings and other forms of web encoded data.

Directives

#cgi::post

Retrieves a URI encoded query string via the POST method and returns a hash complex containing the decoded data.

#cgi::get_query

Retrieves a URI encoded query string based upon the relevant GET or POST method and returns a hash complex containing the decoded data.

#cgi::env

Returns a reference to Perl's %ENV hash.

#cgi::parse_query string

Parses the URI encoded string and returns a reference to a hash reference containing the decoded data.

 [!! #define Query #cgi::parse_query "name.first=Fred&name.last=Mertz" !!]
 First name: [!! Query.name.first !!], Last name: [!! Query.name.last !!]
 [!!
  /* output:
   First name: Fred, Last name: Mertz
  */
 !!]

#cgi::make_query hash

Performs the reverse of #cgi::parse_query. Returns a URI encoded string generated from hash.

 [!!
  #cgi::make_query %<
    one   "single"
    two   "twice that of one"
    three "more than you need"
  >
  /* output (order will vary):
   three=more+than+you+need&one=single&two=twice+that+of+one
  */
 !!]

#cgi::parse_cookies http_cookies

Returns a reference to a hash complex containing decoded data generated from encoded http_cookies data.

 [!! #define cookies #cgi::parse_cookies "foo.bar=bazz; bar.foo=quux" !!]
 foo.bar = [!! cookies.foo.bar !!]
 bar.foo = [!! cookies.bar.foo !!]
 [!!
  /* output:
   foo.bar = bazz
   bar.foo = quux
  */
 !!]

#cgi::make_cookies hash

Performs the reverse of #cgi::parse_cookies - returns an encoded string generated from hash which is suitable for use as an http-cookie.

 [!!
  #cgi::make_cookies %<
    one   "single"
    two   "twice that of one"
    three "more than you need"
  >
  /* output (order will vary):
   three=more+than+you+need; one=single; two=twice+that+of+one
  */
 !!]

#cgi::encode string

Returns a URI encoded version of string.

 [!!
  #cgi::encode "Four score & seven years ago"
  /* output:
   Four+score+&+seven+years+ago
  */
 !!]

#cgi::decode string

Returns a URI decoded version of string.

 [!!
  #cgi::decode "Four+score+&+seven+years+ago"
  /* output:
   Four score & seven years ago
  */
 !!]