The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

App::EscapeUtils - Various string escaping/unescaping utilities

VERSION

This document describes version 0.002 of App::EscapeUtils (from Perl distribution App-EscapeUtils), released on 2019-12-15.

DESCRIPTION

This distributions provides the following command-line utilities:

FUNCTIONS

backslash_escape

Usage:

 backslash_escape(%args) -> [status, msg, payload, 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 (payload) 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, payload, 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 (payload) 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, payload, 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 (payload) 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, payload, 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 (payload) 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, payload, 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 (payload) 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, payload, 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 (payload) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (str)

perl_dquote_escape

Usage:

 perl_dquote_escape(%args) -> [status, msg, payload, meta]

Encode lines of input (in stdin or arguments) inside Perl double-quoted 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 (payload) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (str)

perl_squote_escape

Usage:

 perl_squote_escape(%args) -> [status, msg, payload, meta]

Encode lines of input (in stdin or arguments) inside Perl single-quoted 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 (payload) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (str)

pod_escape

Usage:

 pod_escape(%args) -> [status, msg, payload, meta]

Quote POD special characters in 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 (payload) 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, payload, 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 (payload) 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, payload, 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 (payload) 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, payload, 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 (payload) 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

HTML::Entities

String::ShellQuote and ShellQuote::Any::Tiny

String::xcPodQuote

String::PerlQuote

AUTHOR

perlancar <perlancar@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2019, 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.