qw(
&flush &getname &remove &rewind &sync &tmpnam &vmsopen &vmssysopen &waitfh ); $uniquename
= tmpnam; $fh
= vmsopen(``my.file'',``rfm=var'',``alq=100'',...)
or die $!; $name
= getname($fh);
print $fh
``Hello, world!\n''; flush($fh);
sync($fh);
rewind($fh);
$line
= <$fh>; undef $fh; # closes file $fh
= vmssysopen(``another.file'',
O_RDONLY |
O_NDELAY, 0, ``ctx=bin''); sysread($fh,$data,128);
waitfh($fh);
close($fh);
remove(``another.file'');
All of the routines are available for export, though none are exported by default. All of the constants used by vmssysopen to specify access modes are exported by default. The routines are associated with the Exporter tag FUNCTIONS, and the constants are associated with the Exporter tag CONSTANTS, so you can more easily choose what you'd like to import:
# import constants, but not functions use VMS::Stdio; # same as use VMS::Stdio qw( :DEFAULT ); # import functions, but not constants use VMS::Stdio qw( !:CONSTANTS :FUNCTIONS ); # import both use VMS::Stdio qw( :CONSTANTS :FUNCTIONS ); # import neither use VMS::Stdio ();
Of course, you can also choose to import specific functions by name, as usual.
This package ISA
IO::File, so that you can call IO::File methods on the handles returned by vmsopen and vmssysopen. The IO::File package is not initialized, however, until you actually call
a method that VMS::Stdio doesn't provide. This is doen to save startup time
for users who don't wish to use the IO::File methods.
Note: In order to conform to naming conventions for Perl extensions and functions, the name of this package has been changed to VMS::Stdio as of Perl 5.002, and the names of some routines have been changed. Calls to the old VMS::stdio routines will generate a warning, and will be routed to the equivalent VMS::Stdio function. This compatibility interface will be removed in a future release of this extension, so please update your code to use the new routines.
fflush()
routine, it does not flush any underlying
RMS buffers for the file, so the data may not be flushed all the way to the disk.
flush
returns a true value if successful, and undef if not.
unlink($file) if VMS::Filespec::candelete($file);
creat()
and fopen()
for details.) If successful,
vmsopen returns a VMS::Stdio file handle; if an error occurs, it returns undef.
You can use the file handle returned by vmsopen just as you would any other Perl file handle. The class VMS::Stdio ISA IO::File, so you can call IO::File methods using the handle returned by vmsopen. However, useing VMS::Stdio does not automatically use IO::File; you must do so explicitly in your program if you want to call IO::File methods. This is done to avoid the overhead of initializing the IO::File package in programs which intend to use the handle returned by vmsopen as a normal Perl file handle only. When the scalar containing a VMS::Stdio file handle is overwritten, undefd, or goes out of scope, the associated file is closed automatically.
sysopen
as vmsopen does to open. Its first three arguments are the name, access flags, and permissions for
the file. Like
vmsopen, it takes up to 8 additional string arguments which specify file
characteristics. Its return value is identical to that of vmsopen.
The symbolic constants for the mode argument are exported by VMS::Stdio by default, and are also exported by the Fcntl package.
fwait().