[Perl] Fix perl for later Linux releases v5.24.1

This commit is contained in:
Akkadius 2017-08-24 04:13:52 -05:00
parent 808654743c
commit 00604722bb
2 changed files with 12 additions and 5 deletions

View File

@ -119,7 +119,7 @@ void Embperl::DoInit() {
perl_run(my_perl);
//a little routine we use a lot.
eval_pv("sub my_eval {eval $_[0];}", TRUE); //dies on error
eval_pv("sub my_eval { eval $_[0];}", TRUE); //dies on error
//ruin the perl exit and command:
eval_pv("sub my_exit {}",TRUE);
@ -149,7 +149,7 @@ void Embperl::DoInit() {
//make a tieable class to capture IO and pass it into EQEMuLog
eval_pv(
"package EQEmuIO; "
"sub TIEHANDLE { my $me = bless {}, $_[0]; $me->PRINT('Creating '.$me); return($me); } "
"sub TIEHANDLE { my $me = bless {}, $_[0]; $me->PRINT('Creating '. $me); return($me); } "
"sub WRITE { } "
//dunno why I need to shift off fmt here, but it dosent like without it
"sub PRINTF { my $me = shift; my $fmt = shift; $me->PRINT(sprintf($fmt, @_)); } "
@ -237,6 +237,7 @@ void Embperl::init_eval_file(void)
{
eval_pv(
"our %Cache;"
"no warnings;"
"use Symbol qw(delete_package);"
"sub eval_file {"
"my($package, $filename) = @_;"
@ -246,8 +247,9 @@ void Embperl::init_eval_file(void)
"if(defined $Cache{$package}{mtime}&&$Cache{$package}{mtime} <= $mtime && !($package eq 'plugin')){"
" return;"
"} else {"
//we 'my' $filename,$mtime,$package,$sub to prevent them from changing our state up here.
" eval(\"package $package; my(\\$filename,\\$mtime,\\$package,\\$sub); \\$isloaded = 1; require '$filename'; \");"
// we 'my' $filename,$mtime,$package,$sub to prevent them from changing our state up here.
" eval(\"package $package; my(\\$filename,\\$mtime,\\$package,\\$sub); \\$isloaded = 1; require './$filename'; \");"
// " print $@ if $@;"
/* "local *FH;open FH, $filename or die \"open '$filename' $!\";"
"local($/) = undef;my $sub = <FH>;close FH;"
"my $eval = qq{package $package; sub handler { $sub; }};"

View File

@ -99,12 +99,17 @@ XS(XS_EQEmuIO_PRINT)
/* Strip newlines from log message 'str' */
*std::remove(str, str + strlen(str), '\n') = '\0';
std::string log_string = str;
if (log_string.find("did not return a true") != std::string::npos)
return;;
int i;
int pos = 0;
int len = 0;
for(i = 0; *cur != '\0'; i++, cur++) {
if(*cur == '\n') {
Log(Logs::General, Logs::Quests, str);
std::string string = StringFormat("%s - bitch", str);
Log(Logs::General, Logs::Quests, string.c_str());
len = 0;
pos = i+1;
} else {