From 61491f76bdcd737a3de9067265026a336f75794a Mon Sep 17 00:00:00 2001 From: Ryan Voots Date: Wed, 24 May 2017 20:21:34 -0400 Subject: [PATCH] Fix encoding issue --- lib/Bot/BB3/Roles/IRC.pm | 2 +- lib/eval.pl | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/Bot/BB3/Roles/IRC.pm b/lib/Bot/BB3/Roles/IRC.pm index cc6296a..ab57864 100644 --- a/lib/Bot/BB3/Roles/IRC.pm +++ b/lib/Bot/BB3/Roles/IRC.pm @@ -575,8 +575,8 @@ sub plugin_output { # Send multiple messages if we're talking in a private chat # Note that in the future we'll probably want to generalize channels # that receive multiple lines and those that don't.. - while( length $text ) { $text = Encode::encode( "utf8", $text ); # set it up for raw bytes now + while( length $text ) { my $substr = substr( $text, 0, 400, '' ); $pci->yield( privmsg => $said->{name} => $substr ); diff --git a/lib/eval.pl b/lib/eval.pl index cf25af1..06afcff 100755 --- a/lib/eval.pl +++ b/lib/eval.pl @@ -60,6 +60,7 @@ $|++; #*STDOUT = $stdh; my %exec_map = ( + 'perl1' => {bin => '/langs/perl-1.0.16/bin/perl'}, 'perl4' => {bin => '/perl5/perlbrew/perls/perl-4.036/bin/perl'}, 'perl5.5' => {bin => '/perl5/perlbrew/perls/perl-5.005_04/bin/perl'}, 'perl5.6' => {bin => '/perl5/perlbrew/perls/perl-5.6.2/bin/perl'}, @@ -86,7 +87,7 @@ no warnings; my $sub; { no strict; no warnings; no charnames; - $sub = eval "use $]; package botdeparse; sub{ $code\n }"; + $sub = eval "use $]; package botdeparse; sub{ $code\n }; use namespace::autoclean;"; } my %methods = (map {$_ => botdeparse->can($_)} grep {botdeparse->can($_)} keys {%botdeparse::}->%*); @@ -111,7 +112,7 @@ no warnings; return $ret; }; - for my $sub (keys %methods) { + for my $sub (grep {!/^(can|DOES|isa)$/} keys %methods) { my $ret = $clean_out->($dp->coderef2text($methods{$sub})); push @out, "sub $sub {$ret} "; @@ -408,7 +409,7 @@ Biqsip biqsip 'ugh chan ghitlh lursa' nuh bey' ngun petaq qeng soj tlhej waqboch } '; - unless ($version eq '4') { + unless ($version eq '4' || $version eq '1') { exec($exec_map{'perl'.$version}{bin}, '-e', $wrapper) or die "Exec failed $!"; } else { exec($exec_map{'perl'.$version}{bin}, '-e', $code); # the code for perl4 is actually still in STDIN, if we try to -e it needs to write files