in reply to Re: filenames from filehandles
in thread filenames from filehandles
$procpath=fileno($fh);
should be
$procpath='/proc/self/fd/'.fileno($fh);
Also, your directory test is missing quotes.
my $filename; if (defined(my $fileno = fileno($fh))) { if ($^O eq 'linux') { my $procpath = "/proc/self/fd/$fileno"; $filename = readlink($procpath); $filename = undef unless -e $filename; } }
|
|---|