diff --git a/PBot/AntiFlood.pm b/PBot/AntiFlood.pm index d9315b47..c63ec84a 100644 --- a/PBot/AntiFlood.pm +++ b/PBot/AntiFlood.pm @@ -16,6 +16,8 @@ package PBot::AntiFlood; use warnings; use strict; +use feature 'unicode_strings'; + use feature 'switch'; no if $] >= 5.018, warnings => "experimental::smartmatch"; @@ -405,7 +407,7 @@ sub check_flood { } if ($self->whitelisted($channel, "$nick!$user\@$host", 'antiflood')) { - $self->{pbot}->{logger}->log("$nick!$user\@$host anti-flood whitelisted, disgregarding ban\n"); + $self->{pbot}->{logger}->log("$nick!$user\@$host anti-flood whitelisted, skipping anti-flood checking\n"); next; } diff --git a/PBot/AntiSpam.pm b/PBot/AntiSpam.pm index 19b35c47..526da036 100644 --- a/PBot/AntiSpam.pm +++ b/PBot/AntiSpam.pm @@ -12,6 +12,8 @@ package PBot::AntiSpam; use warnings; use strict; +use feature 'unicode_strings'; + use feature 'switch'; no if $] >= 5.018, warnings => "experimental::smartmatch"; diff --git a/PBot/BanTracker.pm b/PBot/BanTracker.pm index b0c770e8..4c8b5b48 100644 --- a/PBot/BanTracker.pm +++ b/PBot/BanTracker.pm @@ -15,6 +15,8 @@ package PBot::BanTracker; use warnings; use strict; +use feature 'unicode_strings'; + use Time::HiRes qw/gettimeofday/; use Time::Duration; use Data::Dumper; diff --git a/PBot/BlackList.pm b/PBot/BlackList.pm index 3a8be9c0..0436794b 100644 --- a/PBot/BlackList.pm +++ b/PBot/BlackList.pm @@ -12,6 +12,8 @@ package PBot::BlackList; use warnings; use strict; +use feature 'unicode_strings'; + use feature 'switch'; no if $] >= 5.018, warnings => "experimental::smartmatch"; diff --git a/PBot/BotAdminCommands.pm b/PBot/BotAdminCommands.pm index 0b8b5dd3..bf81f9b9 100644 --- a/PBot/BotAdminCommands.pm +++ b/PBot/BotAdminCommands.pm @@ -12,6 +12,8 @@ package PBot::BotAdminCommands; use warnings; use strict; +use feature 'unicode_strings'; + use feature 'switch'; no if $] >= 5.018, warnings => "experimental::smartmatch"; diff --git a/PBot/BotAdmins.pm b/PBot/BotAdmins.pm index ce20ee79..7f6cc354 100644 --- a/PBot/BotAdmins.pm +++ b/PBot/BotAdmins.pm @@ -12,6 +12,8 @@ package PBot::BotAdmins; use warnings; use strict; +use feature 'unicode_strings'; + use PBot::DualIndexHashObject; use PBot::BotAdminCommands; diff --git a/PBot/ChanOpCommands.pm b/PBot/ChanOpCommands.pm index afa09c1c..63b6c948 100644 --- a/PBot/ChanOpCommands.pm +++ b/PBot/ChanOpCommands.pm @@ -12,6 +12,8 @@ package PBot::ChanOpCommands; use warnings; use strict; +use feature 'unicode_strings'; + use Carp (); use Time::Duration; diff --git a/PBot/ChanOps.pm b/PBot/ChanOps.pm index 2778c8e2..f1c68580 100644 --- a/PBot/ChanOps.pm +++ b/PBot/ChanOps.pm @@ -12,6 +12,8 @@ package PBot::ChanOps; use warnings; use strict; +use feature 'unicode_strings'; + use PBot::ChanOpCommands; use Time::HiRes qw(gettimeofday); diff --git a/PBot/Channels.pm b/PBot/Channels.pm index 49871360..22a99a70 100644 --- a/PBot/Channels.pm +++ b/PBot/Channels.pm @@ -12,6 +12,8 @@ package PBot::Channels; use warnings; use strict; +use feature 'unicode_strings'; + use Carp (); use PBot::HashObject; diff --git a/PBot/Commands.pm b/PBot/Commands.pm index 2d9c8e4c..66bcd8f2 100644 --- a/PBot/Commands.pm +++ b/PBot/Commands.pm @@ -15,6 +15,8 @@ package PBot::Commands; use warnings; use strict; +use feature 'unicode_strings'; + use base 'PBot::Registerable'; use Carp (); diff --git a/PBot/DualIndexHashObject.pm b/PBot/DualIndexHashObject.pm index 22764bf8..0d669db7 100644 --- a/PBot/DualIndexHashObject.pm +++ b/PBot/DualIndexHashObject.pm @@ -13,6 +13,8 @@ package PBot::DualIndexHashObject; use warnings; use strict; +use feature 'unicode_strings'; + use Text::Levenshtein qw(fastdistance); use JSON; use Carp (); diff --git a/PBot/EventDispatcher.pm b/PBot/EventDispatcher.pm index 3c90074d..0ff114ad 100644 --- a/PBot/EventDispatcher.pm +++ b/PBot/EventDispatcher.pm @@ -7,6 +7,8 @@ package PBot::EventDispatcher; use warnings; use strict; +use feature 'unicode_strings'; + use IO::Select; use Carp (); diff --git a/PBot/FactoidCommands.pm b/PBot/FactoidCommands.pm index 40cf0854..9113251e 100644 --- a/PBot/FactoidCommands.pm +++ b/PBot/FactoidCommands.pm @@ -12,6 +12,8 @@ package PBot::FactoidCommands; use warnings; use strict; +use feature 'unicode_strings'; + use Carp (); use Time::Duration; use Time::HiRes qw(gettimeofday); diff --git a/PBot/FactoidModuleLauncher.pm b/PBot/FactoidModuleLauncher.pm index 6656d16c..b801d91a 100644 --- a/PBot/FactoidModuleLauncher.pm +++ b/PBot/FactoidModuleLauncher.pm @@ -12,11 +12,14 @@ package PBot::FactoidModuleLauncher; use warnings; use strict; +use feature 'unicode_strings'; + use POSIX qw(WNOHANG); use Carp (); use Text::Balanced qw(extract_delimited); use JSON; use IPC::Run qw/run timeout/; +use Encode; # automatically reap children processes in background $SIG{CHLD} = sub { while (waitpid(-1, WNOHANG) > 0) {} }; @@ -110,11 +113,17 @@ sub execute_module { } my ($exitval, $stdout, $stderr) = eval { - my @cmdline = ("./$module", $self->{pbot}->{interpreter}->split_line($stuff->{arguments})); + my $args = $stuff->{arguments}; + if (not $stuff->{args_utf8}) { + $args = encode('UTF-8', $args); + } + my @cmdline = ("./$module", $self->{pbot}->{interpreter}->split_line($args)); my $timeout = $self->{pbot}->{registry}->get_value('general', 'module_timeout') // 30; my ($stdin, $stdout, $stderr); run \@cmdline, \$stdin, \$stdout, \$stderr, timeout($timeout); my $exitval = $? >> 8; + utf8::decode($stdout); + utf8::decode($stderr); return ($exitval, $stdout, $stderr); }; @@ -139,8 +148,6 @@ sub execute_module { $stuff->{result} = $stdout; chomp $stuff->{result}; - utf8::decode($stuff->{result}); - my $json = encode_json $stuff; print $writer "$json\n"; exit 0; diff --git a/PBot/Factoids.pm b/PBot/Factoids.pm index d11425a6..6821617c 100644 --- a/PBot/Factoids.pm +++ b/PBot/Factoids.pm @@ -12,6 +12,8 @@ package PBot::Factoids; use warnings; use strict; +use feature 'unicode_strings'; + use feature 'switch'; no if $] >= 5.018, warnings => "experimental::smartmatch"; @@ -711,6 +713,7 @@ sub execute_code_factoid_using_vm { $stuff->{root_channel} = $stuff->{channel}; $stuff->{keyword} = 'compiler'; $stuff->{arguments} = $json; + $stuff->{args_utf8} = 1; $self->{pbot}->{factoids}->{factoidmodulelauncher}->execute_module($stuff); return ""; diff --git a/PBot/HashObject.pm b/PBot/HashObject.pm index f179b66b..dfd4d1cd 100644 --- a/PBot/HashObject.pm +++ b/PBot/HashObject.pm @@ -13,6 +13,8 @@ package PBot::HashObject; use warnings; use strict; +use feature 'unicode_strings'; + use Text::Levenshtein qw(fastdistance); use Carp (); use JSON; diff --git a/PBot/IRC.pm b/PBot/IRC.pm index 3d0158bd..e7bb093d 100644 --- a/PBot/IRC.pm +++ b/PBot/IRC.pm @@ -23,6 +23,7 @@ use PBot::IRC::EventQueue; # pragma_ 2011/01/21 use IO::Select; use Carp; +use feature 'unicode_strings'; # grab the drop-in replacement for time() from Time::HiRes, if it's available BEGIN { diff --git a/PBot/IRC/Connection.pm b/PBot/IRC/Connection.pm index 0522e842..d53a2a6b 100644 --- a/PBot/IRC/Connection.pm +++ b/PBot/IRC/Connection.pm @@ -15,6 +15,8 @@ package PBot::IRC::Connection; # pragma_ 2011/21/01 +use feature 'unicode_strings'; + use PBot::IRC::Event; # pragma_ 2011/21/01 use PBot::IRC::DCC; # pragma_ 2011/21/01 use IO::Socket; diff --git a/PBot/IRC/DCC.pm b/PBot/IRC/DCC.pm index 1a797313..a8067e9f 100644 --- a/PBot/IRC/DCC.pm +++ b/PBot/IRC/DCC.pm @@ -17,7 +17,7 @@ package PBot::IRC::DCC; # pragma_ 2011/21/01 use strict; - +use feature 'unicode_strings'; # --- #perl was here! --- # diff --git a/PBot/IRC/Event.pm b/PBot/IRC/Event.pm index e6e0623a..56085e0e 100644 --- a/PBot/IRC/Event.pm +++ b/PBot/IRC/Event.pm @@ -24,6 +24,8 @@ package PBot::IRC::Event; # pragma_ 2011/21/01 +use feature 'unicode_strings'; + use strict; our %_names; diff --git a/PBot/IRC/EventQueue.pm b/PBot/IRC/EventQueue.pm index 212de7c1..04a645ec 100644 --- a/PBot/IRC/EventQueue.pm +++ b/PBot/IRC/EventQueue.pm @@ -1,5 +1,7 @@ package PBot::IRC::EventQueue; # pragma_ 2011/21/01 +use feature 'unicode_strings'; + use PBot::IRC::EventQueue::Entry; # pragma_ 2011/21/01 use strict; diff --git a/PBot/IRC/EventQueue/Entry.pm b/PBot/IRC/EventQueue/Entry.pm index 8483087c..66ace8b1 100644 --- a/PBot/IRC/EventQueue/Entry.pm +++ b/PBot/IRC/EventQueue/Entry.pm @@ -2,6 +2,8 @@ package PBot::IRC::EventQueue::Entry; # pragma_ 2011/21/01 use strict; +use feature 'unicode_strings'; + my $id = 0; sub new { diff --git a/PBot/IRCHandlers.pm b/PBot/IRCHandlers.pm index 5ef0c728..4d6185f3 100644 --- a/PBot/IRCHandlers.pm +++ b/PBot/IRCHandlers.pm @@ -12,6 +12,8 @@ package PBot::IRCHandlers; use warnings; use strict; +use feature 'unicode_strings'; + use Carp(); use Time::HiRes qw(gettimeofday); use Data::Dumper; diff --git a/PBot/IgnoreList.pm b/PBot/IgnoreList.pm index 5069b896..e3d0366e 100644 --- a/PBot/IgnoreList.pm +++ b/PBot/IgnoreList.pm @@ -12,6 +12,8 @@ package PBot::IgnoreList; use warnings; use strict; +use feature 'unicode_strings'; + use PBot::IgnoreListCommands; use Time::HiRes qw(gettimeofday); diff --git a/PBot/IgnoreListCommands.pm b/PBot/IgnoreListCommands.pm index 2bf1d5df..0405e7d8 100644 --- a/PBot/IgnoreListCommands.pm +++ b/PBot/IgnoreListCommands.pm @@ -12,6 +12,8 @@ package PBot::IgnoreListCommands; use warnings; use strict; +use feature 'unicode_strings'; + use Time::HiRes qw(gettimeofday); use Time::Duration; use Carp (); diff --git a/PBot/Interpreter.pm b/PBot/Interpreter.pm index f1a0a2c0..77aa2069 100644 --- a/PBot/Interpreter.pm +++ b/PBot/Interpreter.pm @@ -12,6 +12,8 @@ package PBot::Interpreter; use warnings; use strict; +use feature 'unicode_strings'; + use base 'PBot::Registerable'; use Time::HiRes qw/gettimeofday/; @@ -329,6 +331,7 @@ sub interpret { # set arguments as a plain string $stuff->{arguments} = $arguments; $stuff->{original_arguments} = $arguments; + delete $stuff->{args_utf8}; # set arguments as an array $stuff->{arglist} = $self->make_args($arguments); @@ -340,6 +343,7 @@ sub interpret { last if defined $result; # reset any manipulated arguments $stuff->{arguments} = $stuff->{original_arguments}; + delete $stuff->{args_utf8}; } return $result; } diff --git a/PBot/LagChecker.pm b/PBot/LagChecker.pm index 7701fb7e..1a89cc6d 100644 --- a/PBot/LagChecker.pm +++ b/PBot/LagChecker.pm @@ -13,6 +13,8 @@ package PBot::LagChecker; use warnings; use strict; +use feature 'unicode_strings'; + use feature 'switch'; use Time::HiRes qw(gettimeofday tv_interval); diff --git a/PBot/Logger.pm b/PBot/Logger.pm index 08d0834f..a338d069 100644 --- a/PBot/Logger.pm +++ b/PBot/Logger.pm @@ -7,6 +7,8 @@ package PBot::Logger; use warnings; use strict; +use feature 'unicode_strings'; + use Carp (); sub new { diff --git a/PBot/MessageHistory.pm b/PBot/MessageHistory.pm index 9cb4415b..592f0de4 100644 --- a/PBot/MessageHistory.pm +++ b/PBot/MessageHistory.pm @@ -16,6 +16,8 @@ package PBot::MessageHistory; use warnings; use strict; +use feature 'unicode_strings'; + use Getopt::Long qw(GetOptionsFromString); use Time::HiRes qw(gettimeofday tv_interval); use Time::Duration; diff --git a/PBot/MessageHistory_SQLite.pm b/PBot/MessageHistory_SQLite.pm index 9cc40a8a..ee244b57 100644 --- a/PBot/MessageHistory_SQLite.pm +++ b/PBot/MessageHistory_SQLite.pm @@ -12,6 +12,8 @@ package PBot::MessageHistory_SQLite; use warnings; use strict; +use feature 'unicode_strings'; + use DBI; use Carp qw(shortmess); use Time::HiRes qw(gettimeofday); diff --git a/PBot/NickList.pm b/PBot/NickList.pm index bc223e8e..b75e07b5 100644 --- a/PBot/NickList.pm +++ b/PBot/NickList.pm @@ -14,6 +14,8 @@ package PBot::NickList; use warnings; use strict; +use feature 'unicode_strings'; + use Text::Levenshtein qw/fastdistance/; use Data::Dumper; $Data::Dumper::Sortkeys = 1; diff --git a/PBot/PBot.pm b/PBot/PBot.pm index 3ac969d4..bbc0c94e 100644 --- a/PBot/PBot.pm +++ b/PBot/PBot.pm @@ -12,6 +12,8 @@ package PBot::PBot; use strict; use warnings; +use feature 'unicode_strings'; + # unbuffer stdout STDOUT->autoflush(1); diff --git a/PBot/Plugins.pm b/PBot/Plugins.pm index 30579d56..045360a8 100644 --- a/PBot/Plugins.pm +++ b/PBot/Plugins.pm @@ -12,6 +12,8 @@ package PBot::Plugins; use warnings; use strict; +use feature 'unicode_strings'; + use File::Basename; use Carp (); diff --git a/PBot/Plugins/ActionTrigger.pm b/PBot/Plugins/ActionTrigger.pm index 86978fbe..83b0650f 100644 --- a/PBot/Plugins/ActionTrigger.pm +++ b/PBot/Plugins/ActionTrigger.pm @@ -7,6 +7,8 @@ package PBot::Plugins::ActionTrigger; use warnings; use strict; +use feature 'unicode_strings'; + use feature 'switch'; no if $] >= 5.018, warnings => "experimental::smartmatch"; diff --git a/PBot/Plugins/AntiAway.pm b/PBot/Plugins/AntiAway.pm index 5f6f3fe0..3a9bfb42 100644 --- a/PBot/Plugins/AntiAway.pm +++ b/PBot/Plugins/AntiAway.pm @@ -12,6 +12,8 @@ package PBot::Plugins::AntiAway; use warnings; use strict; +use feature 'unicode_strings'; + use Carp (); sub new { diff --git a/PBot/Plugins/AntiKickAutoRejoin.pm b/PBot/Plugins/AntiKickAutoRejoin.pm index 235dfad0..9d0f2613 100644 --- a/PBot/Plugins/AntiKickAutoRejoin.pm +++ b/PBot/Plugins/AntiKickAutoRejoin.pm @@ -12,6 +12,8 @@ package PBot::Plugins::AntiKickAutoRejoin; use warnings; use strict; +use feature 'unicode_strings'; + use Carp (); use Time::HiRes qw/gettimeofday/; use Time::Duration; diff --git a/PBot/Plugins/AntiNickSpam.pm b/PBot/Plugins/AntiNickSpam.pm index b2be4ea4..65e24003 100644 --- a/PBot/Plugins/AntiNickSpam.pm +++ b/PBot/Plugins/AntiNickSpam.pm @@ -13,6 +13,8 @@ package PBot::Plugins::AntiNickSpam; use warnings; use strict; +use feature 'unicode_strings'; + use Carp (); use Time::Duration qw/duration/; use Time::HiRes qw/gettimeofday/; diff --git a/PBot/Plugins/AntiRepeat.pm b/PBot/Plugins/AntiRepeat.pm index 96bb592f..d8b01108 100644 --- a/PBot/Plugins/AntiRepeat.pm +++ b/PBot/Plugins/AntiRepeat.pm @@ -10,6 +10,8 @@ use strict; use feature 'switch'; no if $] >= 5.018, warnings => "experimental::smartmatch"; +use feature 'unicode_strings'; + use Carp (); use String::LCSS qw/lcss/; diff --git a/PBot/Plugins/AntiTwitter.pm b/PBot/Plugins/AntiTwitter.pm index 62615957..dcbd1f10 100644 --- a/PBot/Plugins/AntiTwitter.pm +++ b/PBot/Plugins/AntiTwitter.pm @@ -13,6 +13,8 @@ package PBot::Plugins::AntiTwitter; use warnings; use strict; +use feature 'unicode_strings'; + use Carp (); use Time::HiRes qw/gettimeofday/; use Time::Duration qw/duration/; diff --git a/PBot/Plugins/AutoRejoin.pm b/PBot/Plugins/AutoRejoin.pm index 8ce42822..411ec462 100644 --- a/PBot/Plugins/AutoRejoin.pm +++ b/PBot/Plugins/AutoRejoin.pm @@ -12,6 +12,8 @@ package PBot::Plugins::AutoRejoin; use warnings; use strict; +use feature 'unicode_strings'; + use Carp (); use Time::HiRes qw/gettimeofday/; use Time::Duration; diff --git a/PBot/Plugins/Battleship.pm b/PBot/Plugins/Battleship.pm index 3faae1f1..f49abbe5 100644 --- a/PBot/Plugins/Battleship.pm +++ b/PBot/Plugins/Battleship.pm @@ -10,6 +10,8 @@ use strict; use feature 'switch'; no if $] >= 5.018, warnings => "experimental::smartmatch"; +use feature 'unicode_strings'; + use Carp (); use Time::Duration qw/concise duration/; use Data::Dumper; diff --git a/PBot/Plugins/Connect4.pm b/PBot/Plugins/Connect4.pm index f558965b..662d05e6 100644 --- a/PBot/Plugins/Connect4.pm +++ b/PBot/Plugins/Connect4.pm @@ -10,6 +10,8 @@ use strict; use feature 'switch'; no if $] >= 5.018, warnings => "experimental::smartmatch"; +use feature 'unicode_strings'; + use Carp (); use Time::Duration qw/concise duration/; use Data::Dumper; diff --git a/PBot/Plugins/Counter.pm b/PBot/Plugins/Counter.pm index 5553bbe8..9186d928 100644 --- a/PBot/Plugins/Counter.pm +++ b/PBot/Plugins/Counter.pm @@ -10,6 +10,8 @@ use strict; use feature 'switch'; no if $] >= 5.018, warnings => "experimental::smartmatch"; +use feature 'unicode_strings'; + use Carp (); use DBI; use Time::Duration qw/duration/; diff --git a/PBot/Plugins/MagicCommand.pm b/PBot/Plugins/MagicCommand.pm index 2e70062f..fb81b59d 100644 --- a/PBot/Plugins/MagicCommand.pm +++ b/PBot/Plugins/MagicCommand.pm @@ -12,6 +12,8 @@ package PBot::Plugins::MagicCommand; use warnings; use strict; +use feature 'unicode_strings'; + use Carp (); sub new { diff --git a/PBot/Plugins/ParseDate.pm b/PBot/Plugins/ParseDate.pm index a9e5f1bc..a76bf0d2 100644 --- a/PBot/Plugins/ParseDate.pm +++ b/PBot/Plugins/ParseDate.pm @@ -9,6 +9,8 @@ package PBot::Plugins::ParseDate; use warnings; use strict; +use feature 'unicode_strings'; + use Carp (); use Time::Duration qw/duration/; diff --git a/PBot/Plugins/Quotegrabs.pm b/PBot/Plugins/Quotegrabs.pm index 51bfe43f..15a3139e 100644 --- a/PBot/Plugins/Quotegrabs.pm +++ b/PBot/Plugins/Quotegrabs.pm @@ -12,6 +12,8 @@ package PBot::Plugins::Quotegrabs; use warnings; use strict; +use feature 'unicode_strings'; + use HTML::Entities; use Time::Duration; use Time::HiRes qw(gettimeofday); diff --git a/PBot/Plugins/Quotegrabs/Quotegrabs_Hashtable.pm b/PBot/Plugins/Quotegrabs/Quotegrabs_Hashtable.pm index 802987b5..60edf55e 100644 --- a/PBot/Plugins/Quotegrabs/Quotegrabs_Hashtable.pm +++ b/PBot/Plugins/Quotegrabs/Quotegrabs_Hashtable.pm @@ -12,6 +12,8 @@ package PBot::Plugins::Quotegrabs::Quotegrabs_Hashtable; use warnings; use strict; +use feature 'unicode_strings'; + use HTML::Entities; use Time::Duration; use Time::HiRes qw(gettimeofday); diff --git a/PBot/Plugins/Quotegrabs/Quotegrabs_SQLite.pm b/PBot/Plugins/Quotegrabs/Quotegrabs_SQLite.pm index 270ef5c6..e7fa23d0 100644 --- a/PBot/Plugins/Quotegrabs/Quotegrabs_SQLite.pm +++ b/PBot/Plugins/Quotegrabs/Quotegrabs_SQLite.pm @@ -12,6 +12,8 @@ package PBot::Plugins::Quotegrabs::Quotegrabs_SQLite; use warnings; use strict; +use feature 'unicode_strings'; + use DBI; use Carp qw(shortmess); diff --git a/PBot/Plugins/RelayUnreg.pm b/PBot/Plugins/RelayUnreg.pm index 41535bae..0f3e9b55 100644 --- a/PBot/Plugins/RelayUnreg.pm +++ b/PBot/Plugins/RelayUnreg.pm @@ -4,6 +4,8 @@ package PBot::Plugins::RelayUnreg; use warnings; use strict; +use feature 'unicode_strings'; + use Carp (); use Time::HiRes qw/gettimeofday/; diff --git a/PBot/Plugins/RemindMe.pm b/PBot/Plugins/RemindMe.pm index 262f8c85..2b01f3db 100644 --- a/PBot/Plugins/RemindMe.pm +++ b/PBot/Plugins/RemindMe.pm @@ -7,6 +7,8 @@ package PBot::Plugins::RemindMe; use warnings; use strict; +use feature 'unicode_strings'; + use feature 'switch'; no if $] >= 5.018, warnings => "experimental::smartmatch"; diff --git a/PBot/Plugins/Spinach.pm b/PBot/Plugins/Spinach.pm index 44e74ae4..3c3be886 100644 --- a/PBot/Plugins/Spinach.pm +++ b/PBot/Plugins/Spinach.pm @@ -13,6 +13,8 @@ use lib "$FindBin::RealBin/../.."; use feature 'switch'; no if $] >= 5.018, warnings => "experimental::smartmatch"; +use feature 'unicode_strings'; + use Carp (); use JSON; @@ -1532,7 +1534,7 @@ sub normalize_question { sub normalize_text { my ($self, $text) = @_; - $text = unidecode decode('utf8', $text); + $text = unidecode $text; $text =~ s/^\s+|\s+$//g; $text =~ s/\s+/ /g; diff --git a/PBot/Plugins/Spinach/Rank.pm b/PBot/Plugins/Spinach/Rank.pm index 2bc054b2..46c5fd83 100644 --- a/PBot/Plugins/Spinach/Rank.pm +++ b/PBot/Plugins/Spinach/Rank.pm @@ -9,6 +9,8 @@ package PBot::Plugins::Spinach::Rank; use warnings; use strict; +use feature 'unicode_strings'; + use FindBin; use lib "$FindBin::RealBin/../../.."; diff --git a/PBot/Plugins/Spinach/Stats.pm b/PBot/Plugins/Spinach/Stats.pm index bfc4ef92..77f8b5b3 100644 --- a/PBot/Plugins/Spinach/Stats.pm +++ b/PBot/Plugins/Spinach/Stats.pm @@ -9,6 +9,8 @@ package PBot::Plugins::Spinach::Stats; use warnings; use strict; +use feature 'unicode_strings'; + use DBI; use Carp qw(shortmess); diff --git a/PBot/Plugins/UrlTitles.pm b/PBot/Plugins/UrlTitles.pm index 5647aa98..bed45957 100644 --- a/PBot/Plugins/UrlTitles.pm +++ b/PBot/Plugins/UrlTitles.pm @@ -12,6 +12,8 @@ package PBot::Plugins::UrlTitles; use warnings; use strict; +use feature 'unicode_strings'; + use Carp (); sub new { diff --git a/PBot/Plugins/_Example.pm b/PBot/Plugins/_Example.pm index 45d42e7a..dba538b3 100644 --- a/PBot/Plugins/_Example.pm +++ b/PBot/Plugins/_Example.pm @@ -7,6 +7,8 @@ package PBot::Plugins::_Example; use warnings; use strict; +use feature 'unicode_strings'; + use Carp (); sub new { diff --git a/PBot/Refresher.pm b/PBot/Refresher.pm index 2bcd1c68..621a3557 100644 --- a/PBot/Refresher.pm +++ b/PBot/Refresher.pm @@ -13,6 +13,8 @@ package PBot::Refresher; use warnings; use strict; +use feature 'unicode_strings'; + use Module::Refresh; use Carp (); diff --git a/PBot/Registerable.pm b/PBot/Registerable.pm index 9e99459c..f2531294 100644 --- a/PBot/Registerable.pm +++ b/PBot/Registerable.pm @@ -12,6 +12,8 @@ package PBot::Registerable; use warnings; use strict; +use feature 'unicode_strings'; + use Carp (); sub new { diff --git a/PBot/Registry.pm b/PBot/Registry.pm index 97282683..e0f5d2f2 100644 --- a/PBot/Registry.pm +++ b/PBot/Registry.pm @@ -13,6 +13,8 @@ package PBot::Registry; use warnings; use strict; +use feature 'unicode_strings'; + use Time::HiRes qw(gettimeofday); use Carp (); diff --git a/PBot/RegistryCommands.pm b/PBot/RegistryCommands.pm index b8e2eedd..359aa485 100644 --- a/PBot/RegistryCommands.pm +++ b/PBot/RegistryCommands.pm @@ -12,6 +12,8 @@ package PBot::RegistryCommands; use warnings; use strict; +use feature 'unicode_strings'; + use Carp (); sub new { diff --git a/PBot/SQLiteLogger.pm b/PBot/SQLiteLogger.pm index 82da4000..13a05b67 100644 --- a/PBot/SQLiteLogger.pm +++ b/PBot/SQLiteLogger.pm @@ -13,6 +13,8 @@ package PBot::SQLiteLogger; use strict; use warnings; +use feature 'unicode_strings'; + use Carp; use Time::HiRes qw(gettimeofday); diff --git a/PBot/SQLiteLoggerLayer.pm b/PBot/SQLiteLoggerLayer.pm index 7d47da63..25c63fdd 100644 --- a/PBot/SQLiteLoggerLayer.pm +++ b/PBot/SQLiteLoggerLayer.pm @@ -12,6 +12,8 @@ package PBot::SQLiteLoggerLayer; use strict; use warnings; +use feature 'unicode_strings'; + sub PUSHED { my ($class, $mode, $fh) = @_; diff --git a/PBot/SelectHandler.pm b/PBot/SelectHandler.pm index b32e6e8e..221cc8e2 100644 --- a/PBot/SelectHandler.pm +++ b/PBot/SelectHandler.pm @@ -7,6 +7,8 @@ package PBot::SelectHandler; use warnings; use strict; +use feature 'unicode_strings'; + use IO::Select; use Carp (); diff --git a/PBot/StdinReader.pm b/PBot/StdinReader.pm index 08fc6b60..7d035b6e 100644 --- a/PBot/StdinReader.pm +++ b/PBot/StdinReader.pm @@ -7,6 +7,8 @@ package PBot::StdinReader; use warnings; use strict; +use feature 'unicode_strings'; + use POSIX qw(tcgetpgrp getpgrp); # to check whether process is in background or foreground use Carp (); diff --git a/PBot/Timer.pm b/PBot/Timer.pm index 08930640..e98f5b37 100644 --- a/PBot/Timer.pm +++ b/PBot/Timer.pm @@ -14,6 +14,8 @@ package PBot::Timer; use warnings; use strict; +use feature 'unicode_strings'; + use Carp (); our $min_timeout = 1; diff --git a/PBot/Utils/Indefinite.pm b/PBot/Utils/Indefinite.pm index 570f16fa..5a723f12 100644 --- a/PBot/Utils/Indefinite.pm +++ b/PBot/Utils/Indefinite.pm @@ -1,6 +1,8 @@ package PBot::Utils::Indefinite; use 5.010; use warnings; +use feature 'unicode_strings'; + require Exporter; our @ISA = qw/Exporter/; our @EXPORT = qw/prepend_indefinite_article select_indefinite_article/; diff --git a/PBot/Utils/ParseDate.pm b/PBot/Utils/ParseDate.pm index 3325bc43..6fa17e17 100644 --- a/PBot/Utils/ParseDate.pm +++ b/PBot/Utils/ParseDate.pm @@ -7,6 +7,8 @@ use warnings; use strict; +use feature 'unicode_strings'; + package PBot::Utils::ParseDate; use DateTime; diff --git a/PBot/Utils/SafeFilename.pm b/PBot/Utils/SafeFilename.pm index 606cea5c..8d0c2218 100644 --- a/PBot/Utils/SafeFilename.pm +++ b/PBot/Utils/SafeFilename.pm @@ -1,5 +1,6 @@ package PBot::Utils::SafeFilename; use 5.010; use warnings; +use feature 'unicode_strings'; require Exporter; our @ISA = qw/Exporter/; diff --git a/PBot/Utils/ValidateString.pm b/PBot/Utils/ValidateString.pm index 0ffabf97..7d7f7401 100644 --- a/PBot/Utils/ValidateString.pm +++ b/PBot/Utils/ValidateString.pm @@ -3,6 +3,8 @@ package PBot::Utils::ValidateString; use warnings; use strict; +use feature 'unicode_strings'; + require Exporter; our @ISA = qw/Exporter/; our @EXPORT = qw/validate_string/; diff --git a/PBot/VERSION.pm b/PBot/VERSION.pm index 83adae86..e2d959d1 100644 --- a/PBot/VERSION.pm +++ b/PBot/VERSION.pm @@ -14,6 +14,8 @@ package PBot::VERSION; use strict; use warnings; +use feature 'unicode_strings'; + BEGIN { use Exporter; our @ISA = 'Exporter'; diff --git a/PBot/WebPaste.pm b/PBot/WebPaste.pm index 5867e137..d9dab097 100644 --- a/PBot/WebPaste.pm +++ b/PBot/WebPaste.pm @@ -12,6 +12,8 @@ package PBot::WebPaste; use warnings; use strict; +use feature 'unicode_strings'; + use Time::HiRes qw/gettimeofday/; use Time::Duration; use LWP::UserAgent; diff --git a/modules/compiler_vm/compiler_watchdog.pl b/modules/compiler_vm/compiler_watchdog.pl index 644de7f2..8cc336c0 100755 --- a/modules/compiler_vm/compiler_watchdog.pl +++ b/modules/compiler_vm/compiler_watchdog.pl @@ -4,7 +4,7 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -use warnings; +no warnings; use strict; use IPC::Open2; @@ -84,6 +84,7 @@ sub execute { next if not length $line; <$out> and next if $line =~ m/^\(gdb\) No line \d+ in/; + next if $line =~ m/No default breakpoint address/; next if $line =~ m/^\(gdb\) No symbol table/; next if $line =~ m/^\[Detaching after/; next if $line =~ m/^\[New Thread/; diff --git a/modules/compiler_vm/languages/_default.pm b/modules/compiler_vm/languages/_default.pm index a190abd9..f75d7d97 100755 --- a/modules/compiler_vm/languages/_default.pm +++ b/modules/compiler_vm/languages/_default.pm @@ -3,6 +3,7 @@ use warnings; use strict; use feature "switch"; +use feature 'unicode_strings'; no if $] >= 5.018, warnings => "experimental::smartmatch"; @@ -15,6 +16,7 @@ use Time::HiRes qw/gettimeofday/; use Text::Balanced qw/extract_delimited/; use JSON; use Getopt::Long qw/GetOptionsFromArray :config pass_through no_ignore_case no_auto_abbrev/; +use Encode; my $EXECUTE_PORT = '3333'; @@ -278,7 +280,7 @@ sub paste_ixio { return "error pasting: " . $response->status_line; } - my $result = $response->content; + my $result = $response->decoded_content; $result =~ s/^\s+//; $result =~ s/\s+$//; return $result; @@ -371,7 +373,7 @@ sub execute { $compile_in->{'persist-key'} = $self->{'persist-key'} if length $self->{'persist-key'}; my $compile_json = encode_json($compile_in); - $compile_json .= "\n:end:\n"; + $compile_json .= encode('UTF-8', "\n:end:\n"); my $length = length $compile_json; my $sent = 0; @@ -388,7 +390,7 @@ sub execute { #print FILE "Sending chunk [$chunk]\n"; $chunks_sent += length $chunk; - my $ret = syswrite($compiler, "$chunk\n"); + my $ret = syswrite($compiler, $chunk); if (not defined $ret) { print FILE "Error sending: $!\n"; @@ -412,7 +414,8 @@ sub execute { my $got_result = 0; while(my $line = <$compiler_output>) { - print STDERR "Read [$line]\n"; + utf8::decode($line); + print STDERR "Read from vm [$line]\n"; $line =~ s/[\r\n]+$//; last if $line =~ /^result:end$/; diff --git a/pbot.pl b/pbot.pl index a8a0b952..dfba9fe0 100755 --- a/pbot.pl +++ b/pbot.pl @@ -12,6 +12,8 @@ my $VERSION = "1.0.0"; +use feature 'unicode_strings'; + use strict; use warnings;