fixed Butts.pm to handle multi-liine inputs correctly

This commit is contained in:
shabble 2009-11-11 15:27:31 +00:00
parent f11a159bce
commit d237998a9d
2 changed files with 3 additions and 5 deletions

View File

@ -136,7 +136,7 @@ sub is_meme {
sub split_preserving_whitespace {
my ($string) = @_;
my ($leading_ws, $remainder) = ($string =~ m/^(\s*)(.*)$/);
my ($leading_ws, $remainder) = ($string =~ m/^(\s*)(.*)$/s);
$leading_ws //= '';
my @all_split = split(/(\s+)/, $remainder);

View File

@ -25,10 +25,8 @@ POE::Component::Server::TCP->new
my ($kernel, $session, $heap, $input) = @_[KERNEL, SESSION, HEAP, ARG0];
#print "Session ", $session->ID(), " got input: $input\n";
my @fortune = `$fortune`; # ick. But Fortune.pm is shit.
foreach my $line (@fortune) {
$heap->{client}->put($butter->buttify_string($line));
}
my $fortune_str = qx/$fortune/; # ick. But Fortune.pm is shit.
$heap->{client}->put($butter->buttify_string($fortune_str));
$kernel->yield("shutdown");
}
);