in reply to Re^2: zcat pipe gives "gzip: stdout: Broken pipe" error
in thread zcat pipe gives "gzip: stdout: Broken pipe" error

> stat is called using a FILEHANDLE or DIRHANDLE, yet the examples on that page all use stat($filename)

If the $filehandle is associated with a real file, calling stat on it works the same as using the filename directly. But calling stat on a pipe makes no sense, as Perl has no idea what file(s) the command opens and processes.

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

Replies are listed 'Best First'.
Re^4: zcat pipe gives "gzip: stdout: Broken pipe" error
by Special_K (Pilgrim) on Mar 25, 2025 at 22:00 UTC
    > But calling stat on a pipe makes no sense, as Perl has no idea what file(s) the command opens and processes.

    I didn't realize that. In the example from my code where I call stat on the pipe opened to zcat, if I call stat() on the filename and stat() on the open pipe handle and compare the mtime values (last modified), the filename's mtime value is the last modified value as reported in Linux, but the handle's last modified value is the time the pipe was opened.