Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
David Christensen committed Dec 7, 2016
1 parent a452f1c commit ced2a56
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/Vend/CharSet.pm
Expand Up @@ -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 );
}
Expand Down

0 comments on commit ced2a56

Please sign in to comment.