mirror of
https://github.com/pragma-/pbot.git
synced 2024-12-24 19:52:34 +01:00
Improve handling of white-space when splitting output on new-lines
This commit is contained in:
parent
c03a1288b6
commit
321fdc401c
@ -166,7 +166,13 @@ sub handle_result {
|
|||||||
$max_lines = 4 if not defined $max_lines;
|
$max_lines = 4 if not defined $max_lines;
|
||||||
my $lines = 0;
|
my $lines = 0;
|
||||||
|
|
||||||
foreach my $line (split /[\n\r]/, $result) {
|
my $stripped_line;
|
||||||
|
foreach my $line (split /[\n\r]+/, $result) {
|
||||||
|
$stripped_line = $line;
|
||||||
|
$stripped_line =~ s/^\s+//;
|
||||||
|
$stripped_line =~ s/\s+$//;
|
||||||
|
next if not length $stripped_line;
|
||||||
|
|
||||||
if (++$lines >= $max_lines) {
|
if (++$lines >= $max_lines) {
|
||||||
my $link = paste_sprunge("[" . (defined $from ? $from : "stdin") . "] <$nick> $text\n\n$original_result");
|
my $link = paste_sprunge("[" . (defined $from ? $from : "stdin") . "] <$nick> $text\n\n$original_result");
|
||||||
$pbot->{conn}->privmsg($from, "And that's all I have to say about that. See $link for full text.");
|
$pbot->{conn}->privmsg($from, "And that's all I have to say about that. See $link for full text.");
|
||||||
|
@ -13,8 +13,8 @@ use warnings;
|
|||||||
# These are set automatically by the build/commit script
|
# These are set automatically by the build/commit script
|
||||||
use constant {
|
use constant {
|
||||||
BUILD_NAME => "PBot",
|
BUILD_NAME => "PBot",
|
||||||
BUILD_REVISION => 772,
|
BUILD_REVISION => 773,
|
||||||
BUILD_DATE => "2014-08-09",
|
BUILD_DATE => "2014-08-11",
|
||||||
};
|
};
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
Loading…
Reference in New Issue
Block a user