Perl の say 関数を FCGI モードで使用すると、奇妙な動作が発生します。改行は追加されません。なぜこれが起こるのですか?
サンプルコード:
#!/usr/bin/perl -wT
use strict;
use warnings;
use utf8;
use feature qw( say );
use FCGI ();
use CGI qw( header );
my $cnt = 0;
my $req = FCGI::Request();
while ( $req->Accept() >= 0 ) {
$cnt++;
print header( -type => 'text/plain', -charset => 'utf-8' );
say "Hello, world #$cnt";
print "\n";
print "$$\n"
print 'Test 1234';
}
期待される結果 (およびコンソールを介した実際の結果):
Content-Type: text/plain; charset=utf-8
Hello, world. #1
6712
Test 1234
Apache/FCGI による実際の結果:
Content-Type: text/plain; charset=utf-8
Hello, world. #3
6709
Test 1234
いくつかのソフトウェア情報...
Debian Wheezy x86_64 Apache/2.2.22-11 mod_fcgid/1:2.3.6-1.1 Perl/5.14.2-12 FCGI.pm/0.75-1+b1