String::Escape is a Perl module which contains registry of string functions, including backslash escapes.
SYNOPSIS
use String::Escape qw( printable unprintable );
# Convert control, high-bit chars to n or xxx escapes
$output = printable($value);
# Convert escape sequences back to original chars
$value = unprintable($input);
use String::Escape qw( elide );
# Shorten strings to fit, if necessary
foreach (@_) { print elide( $_, 79 ) . "n"; }
use String::Escape qw( string2list list2string );
# Pack and unpack simple lists by quoting each item
$list = list2string( @list );
@list = string2list( $list );
use String::Escape qw( string2hash hash2string );
# Pack and unpack simple hashes by quoting each item
$hash = hash2string( %hash );
%hash = string2hash( $hash );
use String::Escape qw( escape );
# Defer selection of escaping routines until runtime
$escape_name = $use_quotes ? 'qprintable' : 'printable';
@escaped = escape($escape_name, @values);
This module provides a flexible calling interface to some frequently-performed string conversion functions, including applying and removing C/Unix-style backslash escapes like n and t, wrapping and removing double-quotes, and truncating to fit within a desired length.
Furthermore, the escape() function provides for dynamic selection of operations by using a package hash variable to map escape specification strings to the functions which implement them. The lookup imposes a bit of a performance penalty, but allows for some useful late-binding behaviour. Compound specifications (ex. 'quoted uppercase') are expanded to a list of functions to be applied in order. Other modules may also register their functions here for later general use. (See the "CALLING BY NAME" section below for more.)
Product's homepage
Requirements:
· Perl