Sewi has asked for the wisdom of the Perl Monks concerning the following question:
I need to check if a file exists but never ever block on this check.
I tried -e first and then...
(NDELAY is the same as NONBLOCK)sysopen my $fh, $file, O_RDONLY|O_NDELAY; close $fh;
Test scenario:
Ubuntu computer with a sshfs-mounted path where the network cable was disconnected after the path had been mounted.
A external system call is no options as this must be OS independent (at least for Win, Linux, Mac).
alarm() doesn't work - the signal either doesn't fire or it's ignored.
Thanks
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: -e blocking due to unaccessable network fs
by BrowserUk (Patriarch) on Jun 23, 2010 at 12:43 UTC | |
|
Re: -e blocking due to unaccessable network fs
by almut (Canon) on Jun 23, 2010 at 13:25 UTC | |
|
Re: -e blocking due to unaccessable network fs
by Khen1950fx (Canon) on Jun 23, 2010 at 12:12 UTC | |
by Sewi (Friar) on Jun 23, 2010 at 12:38 UTC | |
|
Re: -e blocking due to unaccessable network fs
by Corion (Patriarch) on Jun 23, 2010 at 13:31 UTC |