encoding-source - Side effects of encoding::source

Posted on Tue Mar 11 10:05:14 2008 by andreys
Side effects of encoding::source
As of encoding::source v0.2, it still has side effect of propagating $^ENCODING from compile-time to run-time.

This may be serious if byte strings which contain 8th bit are incorporated as literals (i.e. quotes) after "use encoding::source". Perl feeds them trough "$^ENCODING->cat_decode".

Solution is to change:
else { $LATIN1->$method(@_); }
to something else. Options include returning un"decode"d data in cat_decode for out-of-scope case OR adding some "DESTROY()-itself" object as $^H{__PACKAGE__} value.

This bug report corresponds to my other message concerning encoding::warnings which has similar issue: http://www.cpanforum.com/posts/7304
Write a response