Mailing List Archive

[interchange] Include stubs for proper operation for Vend::CharSet
commit ced2a5639915ed44b2ebd947640c44c362b3fa1e
Author: David Christensen <david@endpoint.com>
Date: Wed Dec 7 11:36:00 2016 -0600

Include stubs for proper operation for Vend::CharSet

When $ENV{MINIVEND_DISABLE_UTF8} is set, make sure we have stubs setup so it'll work as expected in
all cases.

lib/Vend/CharSet.pm | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/lib/Vend/CharSet.pm b/lib/Vend/CharSet.pm
index a508af5..fc98679 100644
--- a/lib/Vend/CharSet.pm
+++ b/lib/Vend/CharSet.pm
@@ -31,7 +31,15 @@ package Vend::CharSet;
use strict;

use utf8; eval "\$\343\201\257 = 42"; # attempt to automatically load the utf8 libraries.
-unless( $ENV{MINIVEND_DISABLE_UTF8} ) {
+
+if ( $ENV{MINIVEND_DISABLE_UTF8} ) {
+ # install stubs for proper operation
+ *is_utf8 = sub { 0 };
+ *find_encoding = sub { };
+ # first arg is encoding, second is data, we're just passing-through
+ *decode = sub { $_[1] };
+}
+else {
require Encode;
import Encode qw( decode is_utf8 find_encoding );
}

_______________________________________________
interchange-cvs mailing list
interchange-cvs@icdevgroup.org
http://www.icdevgroup.org/mailman/listinfo/interchange-cvs