We only use it in one place and have favored test_psgi
in newer tests, so move it out-of-the-way to reduce startup
overhead of other *.t files.
use warnings;
use IO::Socket::INET;
-sub stream_to_string {
- my ($res) = @_;
- my $body = $res->[2];
- my $str = '';
- while (defined(my $chunk = $body->getline)) {
- $str .= $chunk;
- }
- $body->close;
- $str;
-}
-
sub tcp_server () {
IO::Socket::INET->new(
LocalAddr => '127.0.0.1',
require './t/common.perl';
sub string_feed {
- stream_to_string(PublicInbox::Feed::generate($_[0]));
+ my $res = PublicInbox::Feed::generate($_[0]);
+ my $body = $res->[2];
+ my $str = '';
+ while (defined(my $chunk = $body->getline)) {
+ $str .= $chunk;
+ }
+ $body->close;
+ $str;
}
my $tmpdir = tempdir('pi-feed-XXXXXX', TMPDIR => 1, CLEANUP => 1);