fixed Butts.pm to handle multi-liine inputs correctly
This commit is contained in:
parent
f11a159bce
commit
d237998a9d
2
Butts.pm
2
Butts.pm
|
@ -136,7 +136,7 @@ sub is_meme {
|
||||||
sub split_preserving_whitespace {
|
sub split_preserving_whitespace {
|
||||||
my ($string) = @_;
|
my ($string) = @_;
|
||||||
|
|
||||||
my ($leading_ws, $remainder) = ($string =~ m/^(\s*)(.*)$/);
|
my ($leading_ws, $remainder) = ($string =~ m/^(\s*)(.*)$/s);
|
||||||
$leading_ws //= '';
|
$leading_ws //= '';
|
||||||
|
|
||||||
my @all_split = split(/(\s+)/, $remainder);
|
my @all_split = split(/(\s+)/, $remainder);
|
||||||
|
|
|
@ -25,10 +25,8 @@ POE::Component::Server::TCP->new
|
||||||
my ($kernel, $session, $heap, $input) = @_[KERNEL, SESSION, HEAP, ARG0];
|
my ($kernel, $session, $heap, $input) = @_[KERNEL, SESSION, HEAP, ARG0];
|
||||||
#print "Session ", $session->ID(), " got input: $input\n";
|
#print "Session ", $session->ID(), " got input: $input\n";
|
||||||
|
|
||||||
my @fortune = `$fortune`; # ick. But Fortune.pm is shit.
|
my $fortune_str = qx/$fortune/; # ick. But Fortune.pm is shit.
|
||||||
foreach my $line (@fortune) {
|
$heap->{client}->put($butter->buttify_string($fortune_str));
|
||||||
$heap->{client}->put($butter->buttify_string($line));
|
|
||||||
}
|
|
||||||
$kernel->yield("shutdown");
|
$kernel->yield("shutdown");
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue