class IO::Special
Path to special I/O device
does IO
Used as a $.path
attribute in filehandles for special standard input $*IN
and output $*OUT
and $*ERR
. Provides a bridged interface of IO::Handle
, mostly file tests and stringification.
Methods
method new
method new(:!)
Takes a single required attribute what. It is unlikely that you will ever need to construct one of these objects yourself.
method what
say .path.what; # OUTPUT: «<STDIN>»say .path.what; # OUTPUT: «<STDOUT>»say .path.what; # OUTPUT: «<STDERR>»
Returns one of the strings '<STDIN>'
, '<STDOUT>'
, or '<STDERR>'
, specifying the type of the special IO device.
method WHICH
method WHICH(IO::Special: --> Str)
This returns a string that identifies the object. The string is composed by the type of the instance (IO::Special
) and the what
attribute:
.path.what; # OUTPUT: «<STDIN>».path.WHICH; # OUTPUT: «IO::Special<STDIN>»
method Str
method Str(IO::Special:)
This returns '<STDIN>'
, '<STDOUT>'
, or '<STDERR>'
as appropriate.
method IO
method IO(IO::Special: --> IO::Special)
Returns the invocant.
say .path.IO.what; # OUTPUT: «<STDIN>»say .path.what; # OUTPUT: «<STDIN>»
method e
method e(IO::Special: --> True)
The 'exists' file test operator, always returns True
.
method d
method d(IO::Special: --> False)
The 'directory' file test operator, always returns False
.
method f
method f(IO::Special: --> False)
The 'file' file test operator, always returns False
.
method s
method s(IO::Special: --> 0)
The 'size' file test operator, always returns 0
.
method l
method l(IO::Special: --> False)
The 'symbolic links' file test operator, always returns False
.
method r
method r(IO::Special: --> Bool)
The 'read access' file test operator, returns True
if and only if this instance represents the standard input handle(<STDIN>
).
method w
method w(IO::Special: --> Bool)
The 'write access' file test operator, returns True
only if this instance represents either the standard output (<STOUT>
) or the standard error (<STDERR>
) handle.
method x
method x(IO::Special: --> False)
The 'execute access' file test operator, always returns False
.
method modified
method modified(IO::Special: --> Instant)
The last modified time for the filehandle. It always returns an Instant
type object.
method accessed
method accessed(IO::Special: --> Instant)
The last accessed time for the filehandle. It always returns an Instant
type object.
method changed
method changed(IO::Special: --> Instant)
The last changed time for the filehandle. It always returns an Instant
type object.
method mode
method mode(IO::Special: --> Nil)
The mode for the filehandle, it always returns Nil