When VMS Perl (5.5-3A3) opens files, it uses the C RTL open(), which
defaults to exclusive mode, even for read.
This means that Perl cannot read files that are open for write, even if the
writer specified that sharing was allowed. For example, it cannot read batch
log files (it reports %RMS-E-FLK), though the VMS utilities TYPE and
EDIT/TPU etc can read the file.
One way round this is to use vmsopen("file","shr=put"), but this is awkward
to implement if the script is to be used on other systems. And it makes
one-liners quite tricky...
I've just discovered that recent versions of the DECC RTL allow one to
over-ride the default file open mode: (from
http://h71000.www7.hp.com/doc/731FINAL/5763/5763pro_005.html)
"DECC$FILE_SHARING
With DECC$FILE_SHARING enabled, all files are opened with full sharing
enabled (FAB$M_DEL | FAB$M_GET | FAB$M_PUT | FAB$M_UPD). This is set as a
logical OR with any sharing mode specified by the caller."
Unfortunately, there does not appear to be a logical which only applies to
files opened for read, so this also affects output files.
My view is that Perl should open _input_ files using non-exclusive mode, as
it should be up to the writer of the file to use exlusive access if readers
are not allowed.
[Perhaps this is the case with more recent versions of VMS Perl - I've not
checked.]
With the DECC$FILE_SHARING logical it is possible to get behaviour which is
closer to the way that Perl behaves on other OSes.
--
The opinions expressed herein are my own, and are not necessarily endorsed
by my employer ...