Re: Net::FTP
In article news:d8d9rm$24q9$1@nntp.tiki.ne.jp
"H.Yamaguchi" <hyama@mx7.tiki.ne.jp> wrote:
> こんな感じで、二段構えにすると手元の環境では
> うまく行ってる様に見えます。
stdout出力の順序が、実行順序にならないのですね。
main で stdout を close したら接続が切れるので、
この場合は flush があれば良いんですが…
# main.cgi
print "Content-type: text/plain\n\n";
print ">> MAIN 1\n";
open( OUT, '>/dev/stdout' ) || die;
print OUT "Content-type: text/plain\n\n";
print OUT ">> MAIN 2\n";
close OUT;
system( './sub.pl' );
print ">> MAIN 3\n";
open( OUT, '>/dev/stdout' ) || die;
print OUT "Content-type: text/plain\n\n";
print OUT ">> MAIN 4\n";
close OUT;
print ">> MAIN 5\n";
# sub.pl
print "Content-type: text/plain\n\n";
print ">>> SUB 1\n";
open( OUT, '>/dev/stdout' ) || die;
print OUT "Content-type: text/plain\n\n";
print OUT ">>> SUB 2\n";
close( OUT );
print ">>> SUB 3\n";
### 結果 ###
>> MAIN 2
Content-type: text/plain
>> MAIN 1
Content-type: text/plain
>>> SUB 2
Content-type: text/plain
>>> SUB 1
>>> SUB 3
Content-type: text/plain
>> MAIN 4
>> MAIN 3
>> MAIN 5
--
山口@福岡 <hyama@mx7.tiki.ne.jp>
Fnews-brouse 1.9(20180406) -- by Mizuno, MWE <mwe@ccsf.jp>
GnuPG Key ID = ECC8A735
GnuPG Key fingerprint = 9BE6 B9E9 55A5 A499 CD51 946E 9BDC 7870 ECC8 A735