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

Language works on eval now

This commit is contained in:
Ryan Voots 2017-04-24 21:04:53 -04:00
parent b86769b4bd
commit c0d8cffbe2
3 changed files with 6 additions and 3 deletions

View file

@ -101,7 +101,7 @@ sub get_paste {
if ($row) {
$c->stash($row);
$c->stash({page_tmpl => 'viewer.html'});
$c->stash({eval => $c->eval->get_eval($pasteid, $row->{paste}, $row->{lang})});
$c->stash({eval => $c->eval->get_eval($pasteid, $row->{paste}, $row->{language})});
$c->stash({paste_id => $pasteid});
$c->render('page');

View file

@ -24,7 +24,10 @@ sub get_eval {
my $socket = IO::Socket::INET->new( PeerAddr => $self->cfg->{server} //'localhost', PeerPort => $self->cfg->{port} //14400 )
or die "error: cannot connect to eval server";
my $refs = $filter->put( [ { code => "perl $code" } ] ); # TODO make this support other langs
$lang //= "perl";
return undef if ($lang eq 'text');
my $refs = $filter->put( [ { code => $lang . " $code" } ] );
print $socket $refs->[0];
my $output = do {local $/; <$socket>};

View file

@ -13,7 +13,7 @@ sub announce {
my $self = shift;
my ($channel, $who, $what, $link) = @_;
my $socket = IO::Socket::INET->new( PeerAddr => $self->config->{server} //'localhost', PeerPort => $self->cfg->{port} //1784 )
my $socket = IO::Socket::INET->new( PeerAddr => $self->config->{server} //'localhost', PeerPort => $self->config->{port} //1784 )
or die "error: cannot connect to announce server";
print $socket "$channel\x1E$link\x1E$who\x1E$what\n";