use Chj::singlequote qw(singlequote singlequote_many with_maxlen);

    is with_maxlen(9, sub { singlequote "Darc's place" }),


Turn strings to quoted strings.

singlequote ($str, $maybe_alternative)

Perl style quoting.

If $maybe_alternative is not given, uses the string "undef" for the undef value.

singlequote_sh ($str, $maybe_alternative)

Shell style quoting.

Also currently uses the "undef" value as default alternative, although not making much sense.

singlequote_many (@maybe_strs)

In list context returns each argument quoted. In scalar context, join them with a comma inbetween.

Unlike the separate ones above, this captures exceptions during the quoting process (stringification errors) and returns "<stringification error: $@>" in that case.


This is alpha software! Read the status section in the package README or on the website.