H9w do I print a structure?

[email protected] (ToddAndMargo via perl6-users) Thu, 10 Apr 2025 23:19:31 -0700
Newsgroups perl.perl6.users
Message-ID <[email protected]>
Hi All,

I am not having any luck printing the values of a OOP
structure, except for printing them one at a time.  I
can get it to messily print with `say`, but I want to
do it with `print` so I can control the line feeds,
comments, etc..

What am I doing wrong?

Many thanks,
-T


[0] > class PartitionClass{
     has Str $.DeviceID          is rw;
     has Str $.VolumeName        is rw;
     has Str $.ProviderName      is rw;
     has Str $.UNC_BackupPath    is rw;
     has Int $.DriveType         is rw;
     has Str $.DriveTypeStr      is rw;
     has Int $.FreeSpace         is rw;
     has Int $.Size              is rw;
     has Int $.PercentUsed       is rw;
     has Int $.PercentRemaining  is rw;
}
(PartitionClass)


[1] > my $Partition = PartitionClass.new(
     DeviceID         => "",
     VolumeName       => "",
     ProviderName     => "",
     UNC_BackupPath   => "",
     DriveType        => 0,
     DriveTypeStr     => "Unknown",
     FreeSpace        => 0,
     Size             => 0,
     PercentUsed      => 0,
     PercentRemaining => 100
);
PartitionClass.new(DeviceID => "", VolumeName => "", ProviderName => "", 
UNC_BackupPath => "", DriveType => 0, DriveTypeStr => "Unknown", 
FreeSpace => 0, Size => 0, PercentUsed => 0, PercentRemaining => 100)


[2] > for $Partition.kv -> $i, $j { print "i <$i>   j <$j>\n" }
i <0>   j <PartitionClass<4875316684000>>


[2] > print $Partition ~ "\n";
PartitionClass<4875316684000>


[2] > say $Partition;
PartitionClass.new(DeviceID => "", VolumeName => "", ProviderName => "", 
UNC_BackupPath => "", DriveType => 0, DriveTypeStr => "Unknown", 
FreeSpace => 0, Size => 0, PercentUsed => 0, PercentRemaining => 100)