In Attribute§

See primary documentation in context for method set value.

method set_value(Mu $obj, Mu \new_val)

Binds the value new_val to this attribute of object $obj.

class A {
    has $!a = 5;
    method speak() { say $!a; }
}
my $attr = A.^attributes(:local)[0];
my $a = A.new;
$a.speak; # OUTPUT: «5␤»
$attr.set_value($a, 42);
$a.speak; # OUTPUT: «42␤»

Note that this method violates encapsulation of the object, and should be used with care. Here be dragons.