1
0
Fork 0
mirror of https://github.com/perlbot/perlbuut synced 2025-06-07 17:05:43 -04:00

Fix encoding issue

This commit is contained in:
Ryan Voots 2017-05-24 20:21:34 -04:00
parent b8e6138d19
commit 61491f76bd
2 changed files with 5 additions and 4 deletions

View file

@ -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 );

View file

@ -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