CGIに依存しないPerlの話題一般/Part2 (258レス)
前次1-
抽出解除 レス栞

24
(1): 21 02/09/02 15:20 ID:??? AAS
うーん、
ソモソモPerlのスクリプトからファイルディスクリプタにアクセスする手段なんて
標準では用意されてない故、質問自体が謎って問題が有るのだが。
# 内部API経由で取れたと思ったけど

Cで言うところのauto変数的なイメージなら別にmyで良いし、
一時的にスタックに退避させて(Perlではこーいう表現しないけど)
別のファイルハンドルを保持したいって話ならlocalで良いし。

で、一番つまんないオチが
open HANDLENAME, $path_to_file;

とかで作ったファイルハンドルHANDLENAMEをスカラ変数に格納したいってのかしら。

my $handle = \*HANDLENAME;

なり、IO::Fileなりで好きにして。
26
(1): 24 02/09/02 18:03 ID:??? AAS
ぎゃふん。
なるほどfileno()ですか。

% perldoc -f open

If you specify "'<&=N'", where "N" is a number, then Perl will
do an equivalent of C's "fdopen" of that file descriptor; this
is more parsimonious of file descriptors. For example:

open(FILEHANDLE, "<&=$fd")

でも
Note that this feature depends on the fdopen() C library
function. On many UNIX systems, fdopen() is known to fail when
file descriptors exceed a certain value, typically 255. If you
need more file descriptors than that, consider rebuilding Perl
to use the "sfio" library.

ってビミョーですな。
前次1-
スレ情報 赤レス抽出 画像レス抽出 歴の未読スレ

ぬこの手 ぬこTOP 0.700s*