| OpenResty documentation | view source | Contained in the OpenResty distribution. |
OpenResty::Util - Utility functions for OpenResty
This module exports a set of utility functions used for other OpenResty server components.
This module exports the following functions by default:
$value = _IDENT($value)Validates if $value is an well-formed identifier in OpenResty's sense. Essentially it's specified by the following Perl regex:
/^[A-Za-z]\w*$/
_IDENT returns the input argument if it's well-formed; undef otherwise.
$quoted = Q($value)Quotes the value as if it's a SQL value literal. Basically, foo's bar will become 'foo''s bar'.
$quoted = QI($value)Quotes the value as if it's a SQL identifier literal. Basically, foo will become "foo".
$bool = check_password($password)Checks whether the given password ($password) is well-formed. 1 if true, undef otherwise.
$content = slurp($filename)Returns all the content of the file specified by $filename.
$cgi = new_mocked_cgi($url, $content)Returns a mocked-up CGI object from URL (specified by $url) and the HTTP request content (specified by $content).
Agent Zhang (agentzh) <agentzh@yahoo.cn>.
| OpenResty documentation | view source | Contained in the OpenResty distribution. |