manakai

Message::CGI::Util

manakai CGI Utilities

SYNOPSIS

  use Message::CGI::Util qw(htescape percent_encode);
  
  print htescape "ab < cd";
  print q<http://www.example.com/> . percent_encode "\x{4e00} = 1";

DESCRIPTION

The Message::CGI::Util module provides various functions which are particulary useful in CGI scripts.

FUNCTIONS

Functions are not exported by default. You have to explicitly import functions you'd like to use as:

  use Message::CGI::Util qw(function1 function2 ...);
STRING = htescape STRING

Escapes the given string for the use in HTML/XML markups.

OCTETS = percent_encode CHARS

Percene-encodes the given character string. Characters are encode in utf8 and then percent-encoded. Any character other than RFC 3986's unreserved characters are encoded.

OCTETS = percent_encode_na CHARS

Percent-encodes the given character string. It works as percent_encode does, except that this function only encodes non-ASCII characters. Reserved ASCII characters are not encoded.

CHARS = percent_decode OCTETS

Percent-decodes the given byte string and then decoded as UTF-8.

ABSURL = get_absolute_url RELURL, BASEURL

Resolves the relative reference against the given base URL and returns the RFC 3986 absolute URI.

STRING = datetime_in_content TIME_T

Formats the given time in the "date or time strings in content" format defined in earlier drafts of the Web Applications 1.0 specification.

STRING = datetime_for_http TIME_T

Formats the given time in the RFC 1123 format defined in the RFC 2616 (HTTP/1.1).

SEE ALSO

The URL::PercentEncode module provides more comprehensive set of functions to percent-encode or percent-decode strings. The module is available from <https://suika.suikawiki.org/gate/git/wi/perl/webutils.git>.

AUTHOR

Wakaba <wakaba@suikawiki.org>

LICENSE

Copyright 2008-2010 Wakaba <wakaba@suikawiki.org>

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