NAME
OpenResty::Util - Utility functions for OpenResty
DESCRIPTION
This module exports a set of utility functions used for other OpenResty server components.
FUNCTIONS
This module exports the following functions by default:
$value = _IDENT($value)-
Validates if
$valueis an well-formed identifier in OpenResty's sense. Essentially it's specified by the following Perl regex:/^[A-Za-z]\w*$/_IDENTreturns 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 barwill become'foo''s bar'. $quoted = QI($value)-
Quotes the value as if it's a SQL identifier literal. Basically,
foowill 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).
AUTHOR
Agent Zhang (agentzh) <agentzh@yahoo.cn>.