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:
$value
/^[A-Za-z]\w*$/
_IDENT returns the input argument if it's well-formed; undef otherwise.
_IDENT
$quoted = Q($value)
Quotes the value as if it's a SQL value literal. Basically, foo's bar will become 'foo''s bar'.
foo's bar
'foo''s bar'
$quoted = QI($value)
Quotes the value as if it's a SQL identifier literal. Basically, foo will become "foo".
foo
"foo"
$bool = check_password($password)
Checks whether the given password ($password) is well-formed. 1 if true, undef otherwise.
$password
$content = slurp($filename)
Returns all the content of the file specified by $filename.
$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).
$url
$content
Agent Zhang (agentzh) <agentzh@yahoo.cn>.
<agentzh@yahoo.cn>
OpenResty.
To install OpenResty, copy and paste the appropriate command in to your terminal.
cpanm
cpanm OpenResty
CPAN shell
perl -MCPAN -e shell install OpenResty
For more information on module installation, please visit the detailed CPAN module installation guide.