mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-26 05:49:27 +01:00
Updated factoids; added compiler_client.pl module
This commit is contained in:
parent
023dd4bd09
commit
e943790827
@ -13,7 +13,7 @@ use warnings;
|
||||
# These are set automatically by the build/commit script
|
||||
use constant {
|
||||
BUILD_NAME => "PBot",
|
||||
BUILD_REVISION => 239,
|
||||
BUILD_REVISION => 240,
|
||||
BUILD_DATE => "2011-01-19",
|
||||
};
|
||||
|
||||
|
2793
data/factoids
2793
data/factoids
File diff suppressed because it is too large
Load Diff
40
modules/compiler_client.pl
Executable file
40
modules/compiler_client.pl
Executable file
@ -0,0 +1,40 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
# compiler_client.pl connects to compiler_server.pl hosted at PeerAddr/PeerPort below
|
||||
# and sends a nick, language and code, then retreives and prints the compilation/execution output.
|
||||
#
|
||||
# this way we can run the compiler virtual machine on any remote server.
|
||||
|
||||
use warnings;
|
||||
use strict;
|
||||
|
||||
use IO::Socket;
|
||||
|
||||
my $sock = IO::Socket::INET->new(
|
||||
PeerAddr => '127.0.0.1',
|
||||
PeerPort => 9000,
|
||||
Proto => 'tcp');
|
||||
|
||||
if(not defined $sock) {
|
||||
print "Fatal error compiling: $!; try the !cc2 command instead\n";
|
||||
die $!;
|
||||
}
|
||||
|
||||
my $nick = shift @ARGV;
|
||||
my $code = join ' ', @ARGV;
|
||||
|
||||
my $lang = "C99";
|
||||
|
||||
if($code =~ s/-lang=([^ ]+)//) {
|
||||
$lang = uc $1;
|
||||
}
|
||||
|
||||
print $sock "compile:$nick:$lang\n";
|
||||
print $sock "$code\n";
|
||||
print $sock "compile:end\n";
|
||||
|
||||
while(my $line = <$sock>) {
|
||||
print "$line";
|
||||
}
|
||||
|
||||
close $sock;
|
Loading…
Reference in New Issue
Block a user