Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Tweak orphan avoidance again; take revision strings into account.
  • Loading branch information
sorear authored and Perl 6 Evalbot committed Jun 22, 2011
1 parent 94a9b38 commit be41d10
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/EvalbotExecuter.pm
Expand Up @@ -75,7 +75,7 @@ use Encode qw(encode);
use charnames qw(:full);
use POSIX ();

my $max_output_len = 280;
my $max_output_len = 290;

sub run {
my ($program, $executer, $ename) = @_;
Expand All @@ -94,8 +94,11 @@ sub run {
my $null = "\N{SYMBOL FOR NULL}";
$response =~ s/\n/$newline/g;
$response =~ s/\x00/$null/g;
if (bytes::length $response > $max_output_len){
$response = substr $response, 0, $max_output_len - 1;
my $prefix_len = bytes::length($ename) + 2;
if ($executer->{revision}) { $prefix_len += (1 + bytes::length($executer->{revision}->())); }
if (bytes::length($response) + $prefix_len > $max_output_len){
my $target = $max_output_len - 3 - $prefix_len;
$response = substr $response, 0, $target;
$response .= '';
}
return $response;
Expand Down

0 comments on commit be41d10

Please sign in to comment.