IO::Special Reference
Path to special I/O device
What it is #
Routines #
Signatures are reproduced from the documentation, including their declared return types. A routine listed here is part of the type's published interface; whether Raku++ implements it is a separate question, answered by the examples below.
method new #
method new(:$!what!)
Takes a single required attribute what. It is unlikely that you will ever need to construct one of these objects yourself.
method what #
Returns one of the strings '<STDIN>', '<STDOUT>', or '<STDERR>', specifying the type of the special IO device.
method WHICH #
method WHICH(IO::Special:D: --> Str)
Returns 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:
method Str #
method Str(IO::Special:D:)
This returns '<STDIN>', '<STDOUT>', or '<STDERR>' as appropriate.
method IO #
method IO(IO::Special:D: --> IO::Special)
Returns IO::Special.
Returns the invocant.
method e #
method e(IO::Special:D: --> True)
Returns True.
The 'exists' file test operator, always returns True.
method d #
method d(IO::Special:D: --> False)
Returns False.
The 'directory' file test operator, always returns False.
method f #
method f(IO::Special:D: --> False)
Returns False.
The 'file' file test operator, always returns False.
method s #
method s(IO::Special:D: --> 0)
Returns 0.
The 'size' file test operator, always returns 0.
method l #
method l(IO::Special:D: --> False)
Returns False.
The 'symbolic links' file test operator, always returns False.
method r #
method r(IO::Special:D: --> Bool)
Returns 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:D: --> Bool)
Returns 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:D: --> False)
Returns False.
The 'execute access' file test operator, always returns False.
method modified #
method modified(IO::Special:D: --> Instant)
Returns Instant.
The last modified time for the filehandle. It always returns an Instant type object.
method accessed #
method accessed(IO::Special:D: --> Instant)
Returns Instant.
The last accessed time for the filehandle. It always returns an Instant type object.
method changed #
method changed(IO::Special:D: --> Instant)
Returns Instant.
The last changed time for the filehandle. It always returns an Instant type object.
method mode #
method mode(IO::Special:D: --> Nil)
Returns Nil.
The mode for the filehandle, it always returns Nil
Examples, run three ways #
Every example below comes from the official documentation, together with the output that documentation asserts. Each was then executed by Rakudo and by Raku++ when this page was built. Where the three agree, one result is shown; where they do not, all three are — because which of them is wrong is exactly the information worth having.
1 doc-drift · 1 no-output · 2 ok
class IO::Special does IO { }Not executed: the documentation states no expected output for this example.
say $*IN.path.what; # OUTPUT: «<STDIN>» say $*OUT.path.what; # OUTPUT: «<STDOUT>» say $*ERR.path.what; # OUTPUT: «<STDERR>»
<STDIN>
<STDOUT>
<STDERR>
Documentation, Rakudo and Raku++ all agree.
$*IN.path.what; # OUTPUT: «<STDIN>» $*IN.path.WHICH; # OUTPUT: «IO::Special<STDIN>»
<STDIN>
IO::Special<STDIN>
Both engines agree; the documentation states something else. Trust the engines.
say $*IN.path.IO.what; # OUTPUT: «<STDIN>» say $*IN.path.what; # OUTPUT: «<STDIN>»
<STDIN>
<STDIN>
Documentation, Rakudo and Raku++ all agree.