Namazu-devel-ja(旧)


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Do NOT use system()



At Mon, 29 Jul 2002 19:17:49 JST,
NOKUBI Takatsugu wrote:
>   HACKING-ja には IO::File を使えとあるので、以下のように書き直してみ
> たのですがどうもうまく動きません...
> 
> 	my $saveout = IO::File->new;
> 	bless *STDOUT{IO}, 'IO::File';
> 	$saveout->open('>&=' . fileno(STDOUT));
> 	STDOUT->open(">$tmpfile3");
> 	system("$pdfinfopath $tmpfile");
> 	STDOUT->flush;
> 	STDOUT->open('>&=' . fileno($saveout));

簡単に、select を利用すればいいんじゃない?

    my $out = util::efopen(">$tmpfile3");
    my $stdout = select($out);
    system("$pdfinfopath $tmpfile");
    select($stdout);

-- 
SATOH Fumiyasu - fumiya @net-thrust.com, @samba.gr.jp, @namazu.org or ...
THRUST Co., Ltd. @ Fujisawa, Kanagawa, Japan - http://www.net-thrust.com
Samba-JP, aka `Samba Users Group Japan'      - http://www.samba.gr.jp
Apache-JP(?), aka `Japan Apache Users Group' - http://www.apache.jp
Namazu, a full-text search engine            - http://www.namazu.org