Shell escaping in Perl

Shell Escaping:

There are several methods for escaping special characters in the Linux shell:

Double quotes: Double-quoted strings require escaping of only a few characters.  Example:
>echo “Some String: &>|\”\$’\`\s\\”
Some String: &>|”$’`\s\
This method is useful as long as the string contains few or no characters that are special to the shell.  It also allows embedding all types of quotes.
Single . . . → Read More: Shell escaping in Perl

utf8::decode() may actually unset the UTF-8 flag

According to the documentation, the utf8::decode() function should generally set/turn on the UTF-8 flag for a string that contains multi-byte characters.  However, apparently, there are circumstances under which utf8::decode() may not only not set the flag, but may actually unset/clear/turn off the flag for a string that contains multi-byte characters.

The following script contains 4 test cases . . . → Read More: utf8::decode() may actually unset the UTF-8 flag

Perl: Default to UTF-8 encoding

The UTF-8 (Unicode) character encoding system is a well supported alternative to the older ISO-8859-1 (Latin-1) system that can make it easier to work with special characters and multiple languages.  Many developers can exercise sufficient control over their system to ensure that:

All Perl source code is encoded in UTF-8
All text input files and streams are encoded . . . → Read More: Perl: Default to UTF-8 encoding

Perl access to local install of the W3C CSS validator

The W3C CSS validator is an online service for checking a stylesheet for standards compliance.  This service can be accessed in Perl via the WebService::Validator::CSS::W3C module, which is handy for automating validation.  However, for checking a large number of stylesheets, it is better to run a local install of the validator so as not to abuse the public . . . → Read More: Perl access to local install of the W3C CSS validator

Perl global error handler

This is in an Apache::ASP based system, but should theoretically work in any web environment.

I wanted to create a global default error handler ($SIG{__DIE__}) that displays the error text on the page.

Some notes:

It is generally recommended that run-time errors be trapped on a case-by-case basis using try/catch style eval statements.
A global handler may be . . . → Read More: Perl global error handler

Perl regular expressions – limit

Just ran into a limitation of Perl regular expressions. It’s mentioned (in brackets!) here: http://www.foo.be/docs/tpj/issues/vol1_2/tpj0102-0006.html, but I didn’t see mention of it in the Perl manual, so this wasn’t easy to track down.

It’s stated as: “Perl currently has an internal limit of 32K repeats for parenthetical items”. The following code is sufficient to demonstrate . . . → Read More: Perl regular expressions – limit