rw
ErrorsCollection

rw

Synthesised documentation from type/Metamodel/AttributeContainer type/IO/Path type/Parameter type/Attribute

From type/Metamodel/AttributeContainer

See Original text in context

method rw($obj)

Returns a true value if method set_rw has been called on this object, that is, if new public attributes are writable by default.

From type/IO/Path

See Original text in context

method rw(IO::Path:D: --> Bool:D)

Returns True if the invocant is a path that exists and is readable and writable. The method will fail with X::IO::DoesNotExist if the path points to a non-existent filesystem entity.

From type/Parameter

See Original text in context

method rw(Parameter:D: --> Bool:D)

Returns True for trait parameters.

my Signature $sig = :(Str $x is rwBool :$is-named);
say $sig.params[0].rw;                             # OUTPUT: «True␤» 
say $sig.params[1].rw;                             # OUTPUT: «False␤»

From type/Attribute

See Original text in context

method rw(Attribute:D: --> Bool:D)

Returns True for attributes that have the "is rw" trait applied to them.

class Library {
    has $.address# Read-only value 
    has @.new-books is rw;
}
my $addr = Library.^attributes(:local)[0];
my $new-books = Library.^attributes(:local)[1];
say $addr.rw;      # OUTPUT: «False␤» 
say $new-books.rw# OUTPUT: «True␤»