class IO::Special

Path to special I/O device

class IO::Special 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(:$!what!)

Takes a single required attribute what. It is unlikely that you will ever need to construct one of these objects yourself.

method what

say $*IN.path.what;  # OUTPUT: «<STDIN>␤» 
say $*OUT.path.what# OUTPUT: «<STDOUT>␤» 
say $*ERR.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:D: --> 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:

$*IN.path.what;  # OUTPUT: «<STDIN>␤» 
$*IN.path.WHICH# OUTPUT: «IO::Special<STDIN>␤»

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 the invocant.

say $*IN.path.IO.what;  # OUTPUT: «<STDIN>␤» 
say $*IN.path.what;     # OUTPUT: «<STDIN>␤»

method e

method e(IO::Special:D: --> True)

The 'exists' file test operator, always returns True.

method d

method d(IO::Special:D: --> False)

The 'directory' file test operator, always returns False.

method f

method f(IO::Special:D: --> False)

The 'file' file test operator, always returns False.

method s

method s(IO::Special:D: --> 0)

The 'size' file test operator, always returns 0.

method l

method l(IO::Special:D: --> False)

The 'symbolic links' file test operator, always returns False.

method r

method r(IO::Special:D: --> 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)

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)

The 'execute access' file test operator, always returns False.

method modified

method modified(IO::Special:D: --> Instant)

The last modified time for the filehandle. It always returns an Instant type object.

method accessed

method accessed(IO::Special:D: --> Instant)

The last accessed time for the filehandle. It always returns an Instant type object.

method changed

method changed(IO::Special:D: --> Instant)

The last changed time for the filehandle. It always returns an Instant type object.

method mode

method mode(IO::Special:D: --> Nil)

The mode for the filehandle, it always returns Nil

Type Graph

Type relations for IO::Special
perl6-type-graph IO::Special IO::Special Any Any IO::Special->Any IO IO IO::Special->IO Mu Mu Any->Mu

Expand above chart