NAME

App::EscapeUtils - Various string escaping/unescaping utilities

VERSION

This document describes version 0.001 of App::EscapeUtils (from Perl distribution App-EscapeUtils), released on 2017-11-26.

DESCRIPTION

This distributions provides the following command-line utilities:

FUNCTIONS

backslash_escape

Usage:

 backslash_escape(%args) -> [status, msg, result, meta]

Escape lines of input using backslash octal sequence (or \r, \n, \t).

This function is not exported.

Arguments ('*' denotes required arguments):

  • strings* => array[str]

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (str)

backslash_unescape

Usage:

 backslash_unescape(%args) -> [status, msg, result, meta]

Restore backslash octal sequence (or \r, \n, \t) to original characters in lines of input (in stdin or arguments).

This function is not exported.

Arguments ('*' denotes required arguments):

  • strings* => array[str]

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (str)

html_escape

Usage:

 html_escape(%args) -> [status, msg, result, meta]

HTML-escape lines of input (in stdin or arguments).

This function is not exported.

Arguments ('*' denotes required arguments):

  • strings* => array[str]

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (str)

html_unescape

Usage:

 html_unescape(%args) -> [status, msg, result, meta]

HTML-unescape lines of input (in stdin or arguments).

This function is not exported.

Arguments ('*' denotes required arguments):

  • strings* => array[str]

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (str)

js_escape

Usage:

 js_escape(%args) -> [status, msg, result, meta]

Encode lines of input (in standard input or arguments) as JSON strings.

This function is not exported.

Arguments ('*' denotes required arguments):

  • strings* => array[str]

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (str)

js_unescape

Usage:

 js_unescape(%args) -> [status, msg, result, meta]

Interpret lines of input (in standard input or arguments) as JSON strings and return the decoded value.

This function is not exported.

Arguments ('*' denotes required arguments):

  • strings* => array[str]

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (str)

shell_escape

Usage:

 shell_escape(%args) -> [status, msg, result, meta]

Shell-escape lines of input (in stdin or arguments).

This function is not exported.

Arguments ('*' denotes required arguments):

  • strings* => array[str]

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (str)

uri_escape

Usage:

 uri_escape(%args) -> [status, msg, result, meta]

URI-escape lines of input (in standard input or arguments).

This function is not exported.

Arguments ('*' denotes required arguments):

  • strings* => array[str]

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (str)

uri_unescape

Usage:

 uri_unescape(%args) -> [status, msg, result, meta]

URI-unescape lines of input (in standard input or arguments).

This function is not exported.

Arguments ('*' denotes required arguments):

  • strings* => array[str]

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (str)

HOMEPAGE

Please visit the project's homepage at https://metacpan.org/release/App-EscapeUtils.

SOURCE

Source repository is at https://github.com/perlancar/perl-App-EscapeUtils.

BUGS

Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=App-EscapeUtils

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

SEE ALSO

URI::Escape

String::JS

String::Escape

AUTHOR

perlancar <perlancar@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2017 by perlancar@cpan.org.

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