diff --git a/Makefile.PL b/Makefile.PL index e6ed126..4348e0e 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -72,5 +72,8 @@ requires 'Mojo::DOM' => 0; requires 'Mojo::DOM::CSS' => 0; requires 'Mojo::Collection' => 0; requires 'YAPE::Regex::Explain' => 0; +requires 'bigint' => 0; +requires 'Math::BigInt' => 0; +requires 'indirect' => 0; WriteAll; diff --git a/bin/evalserver b/bin/evalserver index f3e2d2a..631d86b 100755 --- a/bin/evalserver +++ b/bin/evalserver @@ -1,4 +1,4 @@ -#!/home/ryan/perl5/perlbrew/perls/perl-5.22.0/bin/perl +#!/home/ryan/perl5/perlbrew/perls/blead-april-04/bin/perl #use local::lib; # Guess we're being activated inside bin/, so go up a directory. diff --git a/lib/eval.pl b/lib/eval.pl index dc52dfb..35b1e41 100755 --- a/lib/eval.pl +++ b/lib/eval.pl @@ -50,6 +50,10 @@ require "utf8_heavy.pl"; use arybase; use Errno; +require indirect; + +eval 'use bigint; use Math::BigInt; 1e1000'; + { my $len = eval "lc 'ẞ'"; warn $@ if $@; @@ -105,7 +109,7 @@ eval {"\N{SPARKLE}"}; # force loading of some of the charnames stuff use B::Deparse; # Javascript Libs -BEGIN{ eval "use JavaScript::V8; use JSON::XS; JavaScript::V8::Context->new()->eval('1')"; } +BEGIN{ eval "use JavaScript::V8; require JSON::XS; JavaScript::V8::Context->new()->eval('1')"; } my $JSENV_CODE = do { local $/; open my $fh, "deps/env.js"; <$fh> }; require 'bytes_heavy.pl'; @@ -199,10 +203,10 @@ use Storable qw/nfreeze/; nfreeze([]); #Preload Nfreeze since it's loaded on dem my $kilo = 1024; my $meg = $kilo * $kilo; - my $limit = 768 * $meg; + my $limit = 1024 * $meg; ( - setrlimit(RLIMIT_VMEM, 1024*$meg, 1024*$meg) + setrlimit(RLIMIT_VMEM, 1.5*$limit, 1.5*$limit) and setrlimit(RLIMIT_DATA, $limit, $limit ) and diff --git a/plugins/eval.pm b/plugins/eval.pm index 45f1c09..98d8817 100644 --- a/plugins/eval.pm +++ b/plugins/eval.pm @@ -20,6 +20,7 @@ sub new { command => 1, }; $self->{aliases} = [ qw/jseval jeval phpeval pleval perleval deparse k20eval rbeval pyeval luaeval/ ]; + $self->{dbh} = DBI->connect("dbi:SQLite:dbname=var/evallogs.db"); return $self; } @@ -28,6 +29,7 @@ sub command { my( $self, $said, $pm ) = @_; my $code = $said->{"body"}; + my $dbh = $self->{dbh}; my $type = $said->{command_match}; $type =~ s/^\s*(\w+?)eval/$1/; @@ -66,6 +68,8 @@ sub command { my $result = $filter->get( [ $output ] ); my $resultstr = $result->[0]->[0]; + $dbh->do("INSERT INTO evals (input, output) VALUES (?, ?)", {}, $code, $resultstr); + if (!$said->{captured} && $resultstr !~ /\S/) { $resultstr = "No output."; }