perl.perl6.users https://www.nntp.perl.org/group/perl.perl6.users/ The SF Perl Raku Study Group, 04/27 at 1pm PST (ALREADY IN PROGRESS) by Joseph Brenner via perl6-users

From: Joseph Brenner via perl6-users We've got the Raku Study group going, even as I type. Sorry if the email address change is confusing: doomvox is now tailormoon@pm.me

Zoom meeting link:
https://us02web.zoom.us/j/85308554316?pwd=52Bc9BpWgd7Xsi6tqQT2QhSQ8eWDkM.1

Passcode: 4RakuRoll

2025-04-27T20:16:42Z
Re: How do I print a structure? by ToddAndMargo via perl6-users <p>From: ToddAndMargo via perl6-users On 4/12/25 10:14 AM, Tirifto wrote:<br/>&gt; Hello!<br/>&gt; <br/>&gt; Both `print` and `say` convert their argument to a string, but they do <br/>&gt; so by calling different methods on the argument. `print` calls the <br/>&gt; method `.Str`, while `say` calls the method `.gist`. On custom classes <br/>&gt; (like your PartitionClass), calling `.Str` will only return the object&rsquo;s <br/>&gt; identifier by default, but calling `.gist` (or `.raku`) will return code <br/>&gt; you can run to re-create the object. So to get the same output with <br/>&gt; `print` like you did with `say`, only without the newline, you can do <br/>&gt; `print $Partition.gist` or `print $Partition.raku`. (`.gist` might not <br/>&gt; show the entire code if the text gets too long, so you might prefer to <br/>&gt; use `.raku`.)<br/>&gt; <br/>&gt; Calling `.kv` doesn&rsquo;t work, because objects&nbsp;(/unlike/ maps / tables) <br/>&gt; aren&rsquo;t transparent structures that you can see the insides of. From the <br/>&gt; perspective of OOP, objects are opaque, and the only proper way to look <br/>&gt; inside is by calling their methods. So if you want to be able to see all <br/>&gt; of the object&rsquo;s attributes, you should *give the class a method* that <br/>&gt; will return all of the object&rsquo;s attributes in some form. You could <br/>&gt; override the `.Str` or `.gist` methods if you simply want to print the <br/>&gt; attributes in a nice form, or you could override the `.kv` method if you <br/>&gt; might want to do something else with them. Here&rsquo;s an example:<br/>&gt; <br/>&gt; &nbsp;&nbsp; [0] &gt; class PartitionClass{<br/>&gt; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;has Str $.DeviceID &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;is rw;<br/>&gt; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;has Str $.VolumeName &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;is rw;<br/>&gt; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;has Str $.ProviderName &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;is rw;<br/>&gt; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;has Str $.UNC_BackupPath &nbsp;&nbsp;&nbsp;is rw;<br/>&gt; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;has Int $.DriveType &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;is rw;<br/>&gt; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;has Str $.DriveTypeStr &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;is rw;<br/>&gt; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;has Int $.FreeSpace &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;is rw;<br/>&gt; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;has Int $.Size &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;is rw;<br/>&gt; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;has Int $.PercentUsed &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;is rw;<br/>&gt; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;has Int $.PercentRemaining &nbsp;is rw;<br/>&gt; <br/>&gt; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;#| Return a list of pair objects: (Attribute name =&gt; Attribute<br/>&gt; &nbsp;&nbsp; value)<br/>&gt; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;method pairs(--&gt; Iterable) {<br/>&gt; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:$.DeviceID, :$.VolumeName, :$.ProviderName,<br/>&gt; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:$.UNC_BackupPath, :$.DriveType, :$.DriveTypeStr,<br/>&gt; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:$.FreeSpace, :$.Size, :$.PercentUsed, :$.PercentRemaining;<br/>&gt; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;}<br/>&gt; <br/>&gt; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;#| Return a sequence of attribute names and values interleaved.<br/>&gt; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;method kv(--&gt; Iterable) {<br/>&gt; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$.pairs.map({ .kv }).flat;<br/>&gt; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;}<br/>&gt; <br/>&gt; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;#| Return a string presenting all attributes on a single line.<br/>&gt; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;method Str(--&gt; Str) {<br/>&gt; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$.pairs.map({ .key ~ &ldquo;: &rdquo; ~ .value }).join(&ldquo;, &rdquo;) ~ &ldquo;.&rdquo;;<br/>&gt; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;}<br/>&gt; &nbsp;&nbsp; }<br/>&gt; &nbsp;&nbsp; (PartitionClass)<br/>&gt; <br/>&gt; &nbsp;&nbsp; [1] &gt; my $Partition = PartitionClass.new(<br/>&gt; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;DeviceID &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&gt; &quot;&quot;,<br/>&gt; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;VolumeName &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&gt; &quot;&quot;,<br/>&gt; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;ProviderName &nbsp;&nbsp;&nbsp;&nbsp;=&gt; &quot;&quot;,<br/>&gt; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;UNC_BackupPath &nbsp;&nbsp;=&gt; &quot;&quot;,<br/>&gt; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;DriveType &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&gt; 0,<br/>&gt; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;DriveTypeStr &nbsp;&nbsp;&nbsp;&nbsp;=&gt; &quot;Unknown&quot;,<br/>&gt; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;FreeSpace &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&gt; 0,<br/>&gt; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;Size &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&gt; 0,<br/>&gt; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;PercentUsed &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&gt; 0,<br/>&gt; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;PercentRemaining =&gt; 100<br/>&gt; &nbsp;&nbsp; );<br/>&gt; &nbsp;&nbsp; PartitionClass.new(DeviceID =&gt; &quot;&quot;, VolumeName =&gt; &quot;&quot;, ProviderName =&gt;<br/>&gt; &nbsp;&nbsp; &quot;&quot;, UNC_BackupPath =&gt; &quot;&quot;, DriveType =&gt; 0, DriveTypeStr =&gt; &quot;Unknown&quot;,<br/>&gt; &nbsp;&nbsp; FreeSpace =&gt; 0, Size =&gt;<br/>&gt; &nbsp;&nbsp; 0, PercentUsed =&gt; 0, PercentRemaining =&gt; 100)<br/>&gt; <br/>&gt; &nbsp;&nbsp; [2] &gt; for $Partition.kv -&gt; $i, $j { print &quot;i &lt;$i&gt; &nbsp;&nbsp;j &lt;$j&gt;\n&quot; }<br/>&gt; &nbsp;&nbsp; i &lt;DeviceID&gt; &nbsp;&nbsp;j &lt;&gt;<br/>&gt; &nbsp;&nbsp; i &lt;VolumeName&gt; &nbsp;&nbsp;j &lt;&gt;<br/>&gt; &nbsp;&nbsp; i &lt;ProviderName&gt; &nbsp;&nbsp;j &lt;&gt;<br/>&gt; &nbsp;&nbsp; i &lt;UNC_BackupPath&gt; &nbsp;&nbsp;j &lt;&gt;<br/>&gt; &nbsp;&nbsp; i &lt;DriveType&gt; &nbsp;&nbsp;j &lt;0&gt;<br/>&gt; &nbsp;&nbsp; i &lt;DriveTypeStr&gt; &nbsp;&nbsp;j &lt;Unknown&gt;<br/>&gt; &nbsp;&nbsp; i &lt;FreeSpace&gt; &nbsp;&nbsp;j &lt;0&gt;<br/>&gt; &nbsp;&nbsp; i &lt;Size&gt; &nbsp;&nbsp;j &lt;0&gt;<br/>&gt; &nbsp;&nbsp; i &lt;PercentUsed&gt; &nbsp;&nbsp;j &lt;0&gt;<br/>&gt; &nbsp;&nbsp; i &lt;PercentRemaining&gt; &nbsp;&nbsp;j &lt;100&gt;<br/>&gt; <br/>&gt; &nbsp;&nbsp; [2] &gt; print $Partition ~ &quot;\n&quot;;<br/>&gt; &nbsp;&nbsp; DeviceID: , VolumeName: , ProviderName: , UNC_BackupPath: ,<br/>&gt; &nbsp;&nbsp; DriveType: 0, DriveTypeStr: Unknown, FreeSpace: 0, Size: 0,<br/>&gt; &nbsp;&nbsp; PercentUsed: 0, PercentRemaining: 100.<br/>&gt; <br/>&gt; &nbsp;&nbsp; [2] &gt; say $Partition;<br/>&gt; &nbsp;&nbsp; PartitionClass.new(DeviceID =&gt; &quot;&quot;, VolumeName =&gt; &quot;&quot;, ProviderName =&gt;<br/>&gt; &nbsp;&nbsp; &quot;&quot;, UNC_BackupPath =&gt; &quot;&quot;, DriveType =&gt; 0, DriveTypeStr =&gt; &quot;Unknown&quot;,<br/>&gt; &nbsp;&nbsp; FreeSpace =&gt; 0, Size =&gt;<br/>&gt; &nbsp;&nbsp; 0, PercentUsed =&gt; 0, PercentRemaining =&gt; 100)<br/>&gt; <br/>&gt; Of course, both the code and the formatting of the output could be <br/>&gt; improved. :-)<br/>&gt; <br/>&gt; You could also ask Raku to list all of the object&rsquo;s attributes and then <br/>&gt; find each of their values for your object. This pretty much violates the <br/>&gt; principles of OOP, so it might not be something you want your programs <br/>&gt; to rely on, but if you just need to inspect an object&rsquo;s internal state <br/>&gt; for your personal use, it&rsquo;s probably fine! An example:<br/>&gt; <br/>&gt; &nbsp;&nbsp; [2] &gt; for $Partition.^attributes { say &ldquo;{.name}: {.get_value:<br/>&gt; &nbsp;&nbsp; $Partition}&rdquo; }<br/>&gt; &nbsp;&nbsp; $!DeviceID:<br/>&gt; &nbsp;&nbsp; $!VolumeName:<br/>&gt; &nbsp;&nbsp; $!ProviderName:<br/>&gt; &nbsp;&nbsp; $!UNC_BackupPath:<br/>&gt; &nbsp;&nbsp; $!DriveType: 0<br/>&gt; &nbsp;&nbsp; $!DriveTypeStr: Unknown<br/>&gt; &nbsp;&nbsp; $!FreeSpace: 0<br/>&gt; &nbsp;&nbsp; $!Size: 0<br/>&gt; &nbsp;&nbsp; $!PercentUsed: 0<br/>&gt; &nbsp;&nbsp; $!PercentRemaining: 100<br/>&gt; <br/>&gt; If there are better ways, I&rsquo;m afraid I don&rsquo;t know of them. Hope this <br/>&gt; helps, though! ^ ^<br/>&gt; // Tirifto<br/>&gt; <br/>&gt; On 11. 04. 25 8:19, ToddAndMargo via perl6-users wrote:<br/>&gt;&gt; Hi All,<br/>&gt;&gt;<br/>&gt;&gt; I am not having any luck printing the values of a OOP<br/>&gt;&gt; structure, except for printing them one at a time.&nbsp; I<br/>&gt;&gt; can get it to messily print with `say`, but I want to<br/>&gt;&gt; do it with `print` so I can control the line feeds,<br/>&gt;&gt; comments, etc..<br/>&gt;&gt;<br/>&gt;&gt; What am I doing wrong?<br/>&gt;&gt;<br/>&gt;&gt; Many thanks,<br/>&gt;&gt; -T<br/>&gt;&gt;<br/>&gt;&gt;<br/>&gt;&gt; [0] &gt; class PartitionClass{<br/>&gt;&gt; &nbsp;&nbsp;&nbsp; has Str $.DeviceID&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; is rw;<br/>&gt;&gt; &nbsp;&nbsp;&nbsp; has Str $.VolumeName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; is rw;<br/>&gt;&gt; &nbsp;&nbsp;&nbsp; has Str $.ProviderName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; is rw;<br/>&gt;&gt; &nbsp;&nbsp;&nbsp; has Str $.UNC_BackupPath&nbsp;&nbsp;&nbsp; is rw;<br/>&gt;&gt; &nbsp;&nbsp;&nbsp; has Int $.DriveType&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; is rw;<br/>&gt;&gt; &nbsp;&nbsp;&nbsp; has Str $.DriveTypeStr&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; is rw;<br/>&gt;&gt; &nbsp;&nbsp;&nbsp; has Int $.FreeSpace&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; is rw;<br/>&gt;&gt; &nbsp;&nbsp;&nbsp; has Int $.Size&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; is rw;<br/>&gt;&gt; &nbsp;&nbsp;&nbsp; has Int $.PercentUsed&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; is rw;<br/>&gt;&gt; &nbsp;&nbsp;&nbsp; has Int $.PercentRemaining&nbsp; is rw;<br/>&gt;&gt; }<br/>&gt;&gt; (PartitionClass)<br/>&gt;&gt;<br/>&gt;&gt;<br/>&gt;&gt; [1] &gt; my $Partition = PartitionClass.new(<br/>&gt;&gt; &nbsp;&nbsp;&nbsp; DeviceID&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =&gt; &quot;&quot;,<br/>&gt;&gt; &nbsp;&nbsp;&nbsp; VolumeName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =&gt; &quot;&quot;,<br/>&gt;&gt; &nbsp;&nbsp;&nbsp; ProviderName&nbsp;&nbsp;&nbsp;&nbsp; =&gt; &quot;&quot;,<br/>&gt;&gt; &nbsp;&nbsp;&nbsp; UNC_BackupPath&nbsp;&nbsp; =&gt; &quot;&quot;,<br/>&gt;&gt; &nbsp;&nbsp;&nbsp; DriveType&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =&gt; 0,<br/>&gt;&gt; &nbsp;&nbsp;&nbsp; DriveTypeStr&nbsp;&nbsp;&nbsp;&nbsp; =&gt; &quot;Unknown&quot;,<br/>&gt;&gt; &nbsp;&nbsp;&nbsp; FreeSpace&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =&gt; 0,<br/>&gt;&gt; &nbsp;&nbsp;&nbsp; Size&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =&gt; 0,<br/>&gt;&gt; &nbsp;&nbsp;&nbsp; PercentUsed&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =&gt; 0,<br/>&gt;&gt; &nbsp;&nbsp;&nbsp; PercentRemaining =&gt; 100<br/>&gt;&gt; );<br/>&gt;&gt; PartitionClass.new(DeviceID =&gt; &quot;&quot;, VolumeName =&gt; &quot;&quot;, ProviderName =&gt; <br/>&gt;&gt; &quot;&quot;, UNC_BackupPath =&gt; &quot;&quot;, DriveType =&gt; 0, DriveTypeStr =&gt; &quot;Unknown&quot;, <br/>&gt;&gt; FreeSpace =&gt; 0, Size =&gt; 0, PercentUsed =&gt; 0, PercentRemaining =&gt; 100)<br/>&gt;&gt;<br/>&gt;&gt;<br/>&gt;&gt; [2] &gt; for $Partition.kv -&gt; $i, $j { print &quot;i &lt;$i&gt;&nbsp;&nbsp; j &lt;$j&gt;\n&quot; }<br/>&gt;&gt; i &lt;0&gt;&nbsp;&nbsp; j &lt;PartitionClass&lt;4875316684000&gt;&gt;<br/>&gt;&gt;<br/>&gt;&gt;<br/>&gt;&gt; [2] &gt; print $Partition ~ &quot;\n&quot;;<br/>&gt;&gt; PartitionClass&lt;4875316684000&gt;<br/>&gt;&gt;<br/>&gt;&gt;<br/>&gt;&gt; [2] &gt; say $Partition;<br/>&gt;&gt; PartitionClass.new(DeviceID =&gt; &quot;&quot;, VolumeName =&gt; &quot;&quot;, ProviderName =&gt; <br/>&gt;&gt; &quot;&quot;, UNC_BackupPath =&gt; &quot;&quot;, DriveType =&gt; 0, DriveTypeStr =&gt; &quot;Unknown&quot;, <br/>&gt;&gt; FreeSpace =&gt; 0, Size =&gt; 0, PercentUsed =&gt; 0, PercentRemaining =&gt; 100)<br/>&gt;&gt;<br/><br/><br/>Hi Tirifto,<br/><br/>What a ton of work you put into that response. Very,<br/>very much appreciated!<br/><br/>And yes, it does help. I will be copying your response<br/>down into my keepers.<br/><br/>LOVE oop&#39;s!<br/><br/>-T<br/></p> 2025-04-12T18:56:16Z Re: H9w do I print a structure? by Tirifto <p>From: Tirifto Hello!<br/><br/>Both `print` and `say` convert their argument to a string, but they do <br/>so by calling different methods on the argument. `print` calls the <br/>method `.Str`, while `say` calls the method `.gist`. On custom classes <br/>(like your PartitionClass), calling `.Str` will only return the object&rsquo;s <br/>identifier by default, but calling `.gist` (or `.raku`) will return code <br/>you can run to re-create the object. So to get the same output with <br/>`print` like you did with `say`, only without the newline, you can do <br/>`print $Partition.gist` or `print $Partition.raku`. (`.gist` might not <br/>show the entire code if the text gets too long, so you might prefer to <br/>use `.raku`.)<br/><br/>Calling `.kv` doesn&rsquo;t work, because objects&nbsp;(/unlike/ maps / tables) <br/>aren&rsquo;t transparent structures that you can see the insides of. From the <br/>perspective of OOP, objects are opaque, and the only proper way to look <br/>inside is by calling their methods. So if you want to be able to see all <br/>of the object&rsquo;s attributes, you should *give the class a method* that <br/>will return all of the object&rsquo;s attributes in some form. You could <br/>override the `.Str` or `.gist` methods if you simply want to print the <br/>attributes in a nice form, or you could override the `.kv` method if you <br/>might want to do something else with them. Here&rsquo;s an example:<br/><br/> [0] &gt; class PartitionClass{<br/> &nbsp;&nbsp;&nbsp;has Str $.DeviceID &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;is rw;<br/> &nbsp;&nbsp;&nbsp;has Str $.VolumeName &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;is rw;<br/> &nbsp;&nbsp;&nbsp;has Str $.ProviderName &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;is rw;<br/> &nbsp;&nbsp;&nbsp;has Str $.UNC_BackupPath &nbsp;&nbsp;&nbsp;is rw;<br/> &nbsp;&nbsp;&nbsp;has Int $.DriveType &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;is rw;<br/> &nbsp;&nbsp;&nbsp;has Str $.DriveTypeStr &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;is rw;<br/> &nbsp;&nbsp;&nbsp;has Int $.FreeSpace &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;is rw;<br/> &nbsp;&nbsp;&nbsp;has Int $.Size &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;is rw;<br/> &nbsp;&nbsp;&nbsp;has Int $.PercentUsed &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;is rw;<br/> &nbsp;&nbsp;&nbsp;has Int $.PercentRemaining &nbsp;is rw;<br/><br/> &nbsp;&nbsp;&nbsp;#| Return a list of pair objects: (Attribute name =&gt; Attribute<br/> value)<br/> &nbsp;&nbsp;&nbsp;method pairs(--&gt; Iterable) {<br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:$.DeviceID, :$.VolumeName, :$.ProviderName,<br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:$.UNC_BackupPath, :$.DriveType, :$.DriveTypeStr,<br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:$.FreeSpace, :$.Size, :$.PercentUsed, :$.PercentRemaining;<br/> &nbsp;&nbsp;&nbsp;}<br/><br/> &nbsp;&nbsp;&nbsp;#| Return a sequence of attribute names and values interleaved.<br/> &nbsp;&nbsp;&nbsp;method kv(--&gt; Iterable) {<br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$.pairs.map({ .kv }).flat;<br/> &nbsp;&nbsp;&nbsp;}<br/><br/> &nbsp;&nbsp;&nbsp;#| Return a string presenting all attributes on a single line.<br/> &nbsp;&nbsp;&nbsp;method Str(--&gt; Str) {<br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$.pairs.map({ .key ~ &ldquo;: &rdquo; ~ .value }).join(&ldquo;, &rdquo;) ~ &ldquo;.&rdquo;;<br/> &nbsp;&nbsp;&nbsp;}<br/> }<br/> (PartitionClass)<br/><br/> [1] &gt; my $Partition = PartitionClass.new(<br/> &nbsp;&nbsp;&nbsp;DeviceID &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&gt; &quot;&quot;,<br/> &nbsp;&nbsp;&nbsp;VolumeName &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&gt; &quot;&quot;,<br/> &nbsp;&nbsp;&nbsp;ProviderName &nbsp;&nbsp;&nbsp;&nbsp;=&gt; &quot;&quot;,<br/> &nbsp;&nbsp;&nbsp;UNC_BackupPath &nbsp;&nbsp;=&gt; &quot;&quot;,<br/> &nbsp;&nbsp;&nbsp;DriveType &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&gt; 0,<br/> &nbsp;&nbsp;&nbsp;DriveTypeStr &nbsp;&nbsp;&nbsp;&nbsp;=&gt; &quot;Unknown&quot;,<br/> &nbsp;&nbsp;&nbsp;FreeSpace &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&gt; 0,<br/> &nbsp;&nbsp;&nbsp;Size &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&gt; 0,<br/> &nbsp;&nbsp;&nbsp;PercentUsed &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&gt; 0,<br/> &nbsp;&nbsp;&nbsp;PercentRemaining =&gt; 100<br/> );<br/> PartitionClass.new(DeviceID =&gt; &quot;&quot;, VolumeName =&gt; &quot;&quot;, ProviderName =&gt;<br/> &quot;&quot;, UNC_BackupPath =&gt; &quot;&quot;, DriveType =&gt; 0, DriveTypeStr =&gt; &quot;Unknown&quot;,<br/> FreeSpace =&gt; 0, Size =&gt;<br/> 0, PercentUsed =&gt; 0, PercentRemaining =&gt; 100)<br/><br/> [2] &gt; for $Partition.kv -&gt; $i, $j { print &quot;i &lt;$i&gt; &nbsp;&nbsp;j &lt;$j&gt;\n&quot; }<br/> i &lt;DeviceID&gt; &nbsp;&nbsp;j &lt;&gt;<br/> i &lt;VolumeName&gt; &nbsp;&nbsp;j &lt;&gt;<br/> i &lt;ProviderName&gt; &nbsp;&nbsp;j &lt;&gt;<br/> i &lt;UNC_BackupPath&gt; &nbsp;&nbsp;j &lt;&gt;<br/> i &lt;DriveType&gt; &nbsp;&nbsp;j &lt;0&gt;<br/> i &lt;DriveTypeStr&gt; &nbsp;&nbsp;j &lt;Unknown&gt;<br/> i &lt;FreeSpace&gt; &nbsp;&nbsp;j &lt;0&gt;<br/> i &lt;Size&gt; &nbsp;&nbsp;j &lt;0&gt;<br/> i &lt;PercentUsed&gt; &nbsp;&nbsp;j &lt;0&gt;<br/> i &lt;PercentRemaining&gt; &nbsp;&nbsp;j &lt;100&gt;<br/><br/> [2] &gt; print $Partition ~ &quot;\n&quot;;<br/> DeviceID: , VolumeName: , ProviderName: , UNC_BackupPath: ,<br/> DriveType: 0, DriveTypeStr: Unknown, FreeSpace: 0, Size: 0,<br/> PercentUsed: 0, PercentRemaining: 100.<br/><br/> [2] &gt; say $Partition;<br/> PartitionClass.new(DeviceID =&gt; &quot;&quot;, VolumeName =&gt; &quot;&quot;, ProviderName =&gt;<br/> &quot;&quot;, UNC_BackupPath =&gt; &quot;&quot;, DriveType =&gt; 0, DriveTypeStr =&gt; &quot;Unknown&quot;,<br/> FreeSpace =&gt; 0, Size =&gt;<br/> 0, PercentUsed =&gt; 0, PercentRemaining =&gt; 100)<br/><br/>Of course, both the code and the formatting of the output could be <br/>improved. :-)<br/><br/>You could also ask Raku to list all of the object&rsquo;s attributes and then <br/>find each of their values for your object. This pretty much violates the <br/>principles of OOP, so it might not be something you want your programs <br/>to rely on, but if you just need to inspect an object&rsquo;s internal state <br/>for your personal use, it&rsquo;s probably fine! An example:<br/><br/> [2] &gt; for $Partition.^attributes { say &ldquo;{.name}: {.get_value:<br/> $Partition}&rdquo; }<br/> $!DeviceID:<br/> $!VolumeName:<br/> $!ProviderName:<br/> $!UNC_BackupPath:<br/> $!DriveType: 0<br/> $!DriveTypeStr: Unknown<br/> $!FreeSpace: 0<br/> $!Size: 0<br/> $!PercentUsed: 0<br/> $!PercentRemaining: 100<br/><br/>If there are better ways, I&rsquo;m afraid I don&rsquo;t know of them. Hope this <br/>helps, though! ^ ^<br/>// Tirifto<br/><br/>On 11. 04. 25 8:19, ToddAndMargo via perl6-users wrote:<br/>&gt; Hi All,<br/>&gt;<br/>&gt; I am not having any luck printing the values of a OOP<br/>&gt; structure, except for printing them one at a time.&nbsp; I<br/>&gt; can get it to messily print with `say`, but I want to<br/>&gt; do it with `print` so I can control the line feeds,<br/>&gt; comments, etc..<br/>&gt;<br/>&gt; What am I doing wrong?<br/>&gt;<br/>&gt; Many thanks,<br/>&gt; -T<br/>&gt;<br/>&gt;<br/>&gt; [0] &gt; class PartitionClass{<br/>&gt; &nbsp;&nbsp;&nbsp; has Str $.DeviceID&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; is rw;<br/>&gt; &nbsp;&nbsp;&nbsp; has Str $.VolumeName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; is rw;<br/>&gt; &nbsp;&nbsp;&nbsp; has Str $.ProviderName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; is rw;<br/>&gt; &nbsp;&nbsp;&nbsp; has Str $.UNC_BackupPath&nbsp;&nbsp;&nbsp; is rw;<br/>&gt; &nbsp;&nbsp;&nbsp; has Int $.DriveType&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; is rw;<br/>&gt; &nbsp;&nbsp;&nbsp; has Str $.DriveTypeStr&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; is rw;<br/>&gt; &nbsp;&nbsp;&nbsp; has Int $.FreeSpace&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; is rw;<br/>&gt; &nbsp;&nbsp;&nbsp; has Int $.Size&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; is rw;<br/>&gt; &nbsp;&nbsp;&nbsp; has Int $.PercentUsed&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; is rw;<br/>&gt; &nbsp;&nbsp;&nbsp; has Int $.PercentRemaining&nbsp; is rw;<br/>&gt; }<br/>&gt; (PartitionClass)<br/>&gt;<br/>&gt;<br/>&gt; [1] &gt; my $Partition = PartitionClass.new(<br/>&gt; &nbsp;&nbsp;&nbsp; DeviceID&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =&gt; &quot;&quot;,<br/>&gt; &nbsp;&nbsp;&nbsp; VolumeName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =&gt; &quot;&quot;,<br/>&gt; &nbsp;&nbsp;&nbsp; ProviderName&nbsp;&nbsp;&nbsp;&nbsp; =&gt; &quot;&quot;,<br/>&gt; &nbsp;&nbsp;&nbsp; UNC_BackupPath&nbsp;&nbsp; =&gt; &quot;&quot;,<br/>&gt; &nbsp;&nbsp;&nbsp; DriveType&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =&gt; 0,<br/>&gt; &nbsp;&nbsp;&nbsp; DriveTypeStr&nbsp;&nbsp;&nbsp;&nbsp; =&gt; &quot;Unknown&quot;,<br/>&gt; &nbsp;&nbsp;&nbsp; FreeSpace&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =&gt; 0,<br/>&gt; &nbsp;&nbsp;&nbsp; Size&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =&gt; 0,<br/>&gt; &nbsp;&nbsp;&nbsp; PercentUsed&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =&gt; 0,<br/>&gt; &nbsp;&nbsp;&nbsp; PercentRemaining =&gt; 100<br/>&gt; );<br/>&gt; PartitionClass.new(DeviceID =&gt; &quot;&quot;, VolumeName =&gt; &quot;&quot;, ProviderName =&gt; <br/>&gt; &quot;&quot;, UNC_BackupPath =&gt; &quot;&quot;, DriveType =&gt; 0, DriveTypeStr =&gt; &quot;Unknown&quot;, <br/>&gt; FreeSpace =&gt; 0, Size =&gt; 0, PercentUsed =&gt; 0, PercentRemaining =&gt; 100)<br/>&gt;<br/>&gt;<br/>&gt; [2] &gt; for $Partition.kv -&gt; $i, $j { print &quot;i &lt;$i&gt;&nbsp;&nbsp; j &lt;$j&gt;\n&quot; }<br/>&gt; i &lt;0&gt;&nbsp;&nbsp; j &lt;PartitionClass&lt;4875316684000&gt;&gt;<br/>&gt;<br/>&gt;<br/>&gt; [2] &gt; print $Partition ~ &quot;\n&quot;;<br/>&gt; PartitionClass&lt;4875316684000&gt;<br/>&gt;<br/>&gt;<br/>&gt; [2] &gt; say $Partition;<br/>&gt; PartitionClass.new(DeviceID =&gt; &quot;&quot;, VolumeName =&gt; &quot;&quot;, ProviderName =&gt; <br/>&gt; &quot;&quot;, UNC_BackupPath =&gt; &quot;&quot;, DriveType =&gt; 0, DriveTypeStr =&gt; &quot;Unknown&quot;, <br/>&gt; FreeSpace =&gt; 0, Size =&gt; 0, PercentUsed =&gt; 0, PercentRemaining =&gt; 100)<br/>&gt;<br/></p> 2025-04-12T17:17:05Z Re: rename and unc by ToddAndMargo via perl6-users <p>From: ToddAndMargo via perl6-users <br/>&gt;&gt; On Apr 3, 2025, at 19:05, ToddAndMargo via perl6-users &lt;perl6- <br/>&gt;&gt; users@perl.org&gt; wrote:<br/>&gt;&gt;<br/>&gt;&gt; &gt; On Thu, Apr 3, 2025 at 2:14&#x202F;AM ToddAndMargo via perl6-users &lt;perl6-<br/>&gt;&gt; &gt; users@perl.org &lt;mailto:perl6-users@perl.org&gt;&gt; wrote:<br/>&gt;&gt; &gt;<br/>&gt;&gt; &gt; &nbsp;&nbsp;&nbsp;&nbsp;And another IO ffunctio that does ot work:<br/>&gt;&gt; &gt;<br/>&gt;&gt; &gt; &nbsp;&nbsp;&nbsp;&nbsp;RotateArchives: renaming directory<br/>&gt;&gt; &gt; &nbsp;&nbsp;&nbsp;&nbsp;\\192.168.240.10\oldserver\Backup\MyDocsBackup\backup6 to<br/>&gt;&gt; &gt; &nbsp;&nbsp;&nbsp;&nbsp;\\192.168.240.10\oldserver\Backup\MyDocsBackup\backup4<br/>&gt;&gt; &gt;<br/>&gt;&gt; &gt; &nbsp;&nbsp;&nbsp;&nbsp;Failed to rename<br/>&gt;&gt; &gt; &nbsp;&nbsp;&nbsp;&nbsp;&#39;C:\192.168.240.10\oldserver\Backup\MyDocsBackup\backup6&#39; to<br/>&gt;&gt; &gt; &nbsp;&nbsp;&nbsp;&nbsp;&#39;C:\192.168.240.10\oldserver\Backup\MyDocsBackup\backup4&#39;: Failed to<br/>&gt;&gt; &gt; &nbsp;&nbsp;&nbsp;&nbsp;rename file: no such file or directory<br/>&gt;&gt; &gt;<br/>&gt;&gt; &gt; &nbsp;&nbsp;&nbsp;&nbsp;rename put a freaking C: on teh unc path.<br/>&gt;&gt; &gt;<br/>&gt;&gt; &gt; &nbsp;&nbsp;&nbsp;&nbsp;Another call to powershell. &nbsp;Poop!<br/>&gt;&gt; &gt;<br/>&gt;&gt; &gt;<br/><br/>&gt;&gt; On 4/3/25 12:08 PM, yary wrote:<br/>&gt;&gt;&gt; The first 3 characters of the error is telling you the problem<br/>&gt;&gt;&gt; C:\192<br/>&gt;&gt;&gt; it&#39;s same as in another thread, use Q[\\192 ... instead of &#39;\ <br/>&gt;&gt;&gt; \192 ... , so that you preserve the backslashes.<br/>&gt;&gt;<br/>&gt;&gt; That other thread had that path in a variable. &nbsp;Raku messed<br/>&gt;&gt; with the variable when I made the IO call. &nbsp;&nbsp;And I<br/>&gt;&gt; can not put a variable into a Q[]. &nbsp;&nbsp;AAAAAA HHHH !!!!<br/>&gt;&gt;<br/>&gt;&gt;&gt; OR<br/>&gt;&gt;&gt; double each backslash- `\\\\192.168.240.10\\oldserver ... and then <br/>&gt;&gt;&gt; you can keep using variables as you normally do.<br/>&gt;&gt;&gt; -y<br/>&gt;&gt;<br/>&gt;&gt; Hi Yary,<br/>&gt;&gt;<br/>&gt;&gt; This is a glaring bug.<br/>&gt;&gt;<br/>&gt;&gt; The call was<br/>&gt;&gt; &nbsp;&nbsp;&nbsp;rename &nbsp;$Oldpath &nbsp;$NewPath<br/>&gt;&gt;<br/>&gt;&gt; $OldPath was `\\192.168.240.10\oldserver\Backup\MyDocsBackup\backup6`<br/>&gt;&gt; $NewPath was `\\192.168.240.10\oldserver\Backup\MyDocsBackup\backup4`<br/>&gt;&gt;<br/>&gt;&gt; Once I have something added to a variable, it is HANDS OFF. &nbsp;DO<br/>&gt;&gt; NOT MESS WITH IT. &nbsp;Before then, it is appreciated. &nbsp;BUT NOT AFTER!<br/>&gt;&gt;<br/>&gt;&gt; Not only did rename mess with my variables, but it added `C:` to it.<br/>&gt;&gt;<br/>&gt;&gt; If the powers-that-be ever decide to fix IO under Windows, any <br/>&gt;&gt; workaround I do to get around the current situation will<br/>&gt;&gt; be broken. &nbsp;&nbsp;And back to chasing ghosts again.<br/>&gt;&gt;<br/>&gt;&gt; My solution is to add powershell calls to my NativeWinUtils.rakumod<br/>&gt;&gt; and use them instead of raku&#39;s IO calls.<br/>&gt;&gt;<br/>&gt;&gt; An example:<br/>&gt;&gt;<br/>&gt;&gt; sub DirectoryExists( Str $DirPath &nbsp;&nbsp;&nbsp;&nbsp;--&gt; Bool ) {<br/>&gt;&gt; &nbsp;&nbsp;&nbsp;# $Full DirPath format is \ <br/>&gt;&gt; \192.168.240.10\oldserver\Backup\MyDocsBackup\backup<br/>&gt;&gt; &nbsp;&nbsp;&nbsp;my $SubName &nbsp;&nbsp;&nbsp;= &amp;?ROUTINE.name;<br/>&gt;&gt; &nbsp;&nbsp;&nbsp;my Str $RtnStr = RunCmd &quot;powershell Test-Path $DirPath&quot;, True;<br/>&gt;&gt; &nbsp;&nbsp;&nbsp;$RtnStr = $RtnStr.chomp;<br/>&gt;&gt; &nbsp;&nbsp;&nbsp;if $CommandLine.debug { print &quot;$SubName: powershell Test-Path <br/>&gt;&gt; returned &lt;$RtnStr&gt; for &lt;$DirPath&gt;\n\n&quot;; }<br/>&gt;&gt; &nbsp;&nbsp;&nbsp;if &nbsp;&nbsp;$RtnStr.lc.contains( &quot;true&quot; ) { return True; } else { return <br/>&gt;&gt; False; }<br/>&gt;&gt; }<br/>&gt;&gt;<br/>&gt;&gt; Oh ya, and the above actually works!<br/>&gt;&gt;<br/>&gt;&gt; Forgive my being crabby. &nbsp;I have been coding on this project<br/>&gt;&gt; for over a week. &nbsp;It was only suppose to take a day. &nbsp;I have<br/>&gt;&gt; been CHASING GHOSTS. I am really, really tired. &nbsp;Now I have<br/>&gt;&gt; to remove all of the IO calls from my code and replace them<br/>&gt;&gt; with calls to powershell. &nbsp;&nbsp;AAAA HHHH !!!!!! &nbsp;At least I<br/>&gt;&gt; have finally figured out what was going wrong.<br/>&gt;&gt;<br/>&gt;&gt; Thank you for the help!<br/>&gt;&gt;<br/>&gt;&gt; -T<br/><br/>On 4/11/25 12:53 AM, William Michels via perl6-users wrote:<br/> &gt; From Raku&#39;s `rename` man-page:<br/> &gt;<br/> &gt; &quot;Note: some renames will always fail, such as when the new name is on a<br/> &gt; different storage device. See also: move.&quot;<br/> &gt;<br/> &gt; https://docs.raku.org/routine/rename <br/>&lt;https://docs.raku.org/routine/rename&gt;<br/> &gt;<br/> &gt; HTH, Bill.<br/> &gt;<br/> &gt; PS. If you want Raku code fitting a &#39;create-backup; unlink-original;<br/> &gt; copy-backup-to-original-location&#39; strategy, look here:<br/> &gt;<br/> &gt; https://unix.stackexchange.com/questions/749558/remove-exact-line-from-<br/> &gt; file-if-present-leave-the-rest-of-lines-error-handling/749581#749581<br/><br/><br/>Hi Bill,<br/><br/>Whilst we all wait for Raku for Windows to get their IO<br/>act together, this is how I handled it. Works 100% of<br/>the time:<br/><br/>Thank you for the heads up.<br/><br/>-T<br/><br/><br/>sub Rename( Str $OldPathName, Str $NewName ) returns Bool is export( <br/>:Rename ) {<br/> # powershell.exe Rename-Item -Path &quot;C:\NtUtil\a.txt&quot; -NewName &quot;b.txt&quot;<br/> # $OldPathName should contain the path unless it is the current <br/>directory;<br/> # $NewName just contain the new name, not the path; Note: this is <br/>different than the raku IO &quot;rename&quot;<br/><br/> my Str $SubName = &amp;?ROUTINE.name;<br/> my Str $RtnStr = RunCmd( &quot;powershell.exe Rename-Item -Path &quot; ~ <br/>Q[&quot;] ~ $OldPathName ~ Q[&quot;] ~ &quot; -NewName &quot; ~ Q[&quot;] ~ $NewName ~ Q[&quot;], True );<br/> # print &quot;RtnStr = &lt;$RtnStr&gt;\n&quot;;<br/> if $RtnStr eq &quot;&quot; { return True; } else { return print &quot;$SubName: <br/>ERROR &lt;&quot; ~ $RtnStr.lines[0] ~ &quot;&gt;\n&quot;; return False; }<br/>}<br/><br/></p> 2025-04-11T08:47:37Z Re: rename and unc by William Michels via perl6-users

From: William Michels via perl6-users From Raku's `rename` man-page:

"Note: some renames will always fail, such as when the new name is on a different storage device. See also: move."

https://docs.raku.org/routine/rename

HTH, Bill.

PS. If you want Raku code fitting a 'create-backup; unlink-original; copy-backup-to-original-location' strategy, look here:

https://unix.stackexchange.com/questions/749558/remove-exact-line-from-file-if-present-leave-the-rest-of-lines-error-handling/749581#749581


> On Apr 3, 2025, at 19:05, ToddAndMargo via perl6-users <perl6-users@perl.org> wrote:
>
> > On Thu, Apr 3, 2025 at 2:14 AM ToddAndMargo via perl6-users <perl6-
> > users@perl.org <mailto:perl6-users@perl.org>> wrote:
> >
> > And another IO ffunctio that does ot work:
> >
> > RotateArchives: renaming directory
> > \\192.168.240.10\oldserver\Backup\MyDocsBackup\backup6 to
> > \\192.168.240.10\oldserver\Backup\MyDocsBackup\backup4
> >
> > Failed to rename
> > 'C:\192.168.240.10\oldserver\Backup\MyDocsBackup\backup6' to
> > 'C:\192.168.240.10\oldserver\Backup\MyDocsBackup\backup4': Failed to
> > rename file: no such file or directory
> >
> > rename put a freaking C: on teh unc path.
> >
> > Another call to powershell. Poop!
> >
> >
> On 4/3/25 12:08 PM, yary wrote:
>> The first 3 characters of the error is telling you the problem
>> C:\192
>> it's same as in another thread, use Q[\\192 ... instead of '\\192 ... , so that you preserve the backslashes.
>
> That other thread had that path in a variable. Raku messed
> with the variable when I made the IO call. And I
> can not put a variable into a Q[]. AAAAAA HHHH !!!!
>
>> OR
>> double each backslash- `\\\\192.168.240.10\\oldserver ... and then you can keep using variables as you normally do.
>> -y
>
> Hi Yary,
>
> This is a glaring bug.
>
> The call was
> rename $Oldpath $NewPath
>
> $OldPath was `\\192.168.240.10\oldserver\Backup\MyDocsBackup\backup6`
> $NewPath was `\\192.168.240.10\oldserver\Backup\MyDocsBackup\backup4`
>
> Once I have something added to a variable, it is HANDS OFF. DO
> NOT MESS WITH IT. Before then, it is appreciated. BUT NOT AFTER!
>
> Not only did rename mess with my variables, but it added `C:` to it.
>
> If the powers-that-be ever decide to fix IO under Windows, any workaround I do to get around the current situation will
> be broken. And back to chasing ghosts again.
>
> My solution is to add powershell calls to my NativeWinUtils.rakumod
> and use them instead of raku's IO calls.
>
> An example:
>
> sub DirectoryExists( Str $DirPath --> Bool ) {
> # $Full DirPath format is \\192.168.240.10\oldserver\Backup\MyDocsBackup\backup
> my $SubName = &?ROUTINE.name;
> my Str $RtnStr = RunCmd "powershell Test-Path $DirPath", True;
> $RtnStr = $RtnStr.chomp;
> if $CommandLine.debug { print "$SubName: powershell Test-Path returned <$RtnStr> for <$DirPath>\n\n"; }
> if $RtnStr.lc.contains( "true" ) { return True; } else { return False; }
> }
>
> Oh ya, and the above actually works!
>
> Forgive my being crabby. I have been coding on this project
> for over a week. It was only suppose to take a day. I have
> been CHASING GHOSTS. I am really, really tired. Now I have
> to remove all of the IO calls from my code and replace them
> with calls to powershell. AAAA HHHH !!!!!! At least I
> have finally figured out what was going wrong.
>
> Thank you for the help!
>
> -T
>
>
>
>
>
>

2025-04-11T07:53:51Z
The SF Perl Raku Study Group, 04/13 at 1pm PST by Joseph Brenner

From: Joseph Brenner And riding fast on the heels of the last one, comes The Raku Study Group:

"There is no idea so frivolous or odd which does not appear
to me to be fittingly produced by the mind of man. Those
of us who deprive our judgment of the right to pass
sentence look gently on strange opinions; we may not lend
them our approbation but we do readily lend them our ears."

Michel de Montaigne, "The Art of Conference" (1588)
Translation: M.A. Screech

April 13, 2025 1pm in California, 8pm in the UK

An informal meeting: drop by when you can, show us what you've got,
ask and answer questions, or just listen and lurk.

Perl and programming in general are fair game, along with Raku,

Zoom meeting link:
https://us02web.zoom.us/j/89366078473?pwd=Iu8rQKIeZ3vRlhDZbaalmXAW8EJRkq.1

Passcode: 4RakuRoll

2025-04-11T06:42:22Z
H9w do I print a structure? by ToddAndMargo via perl6-users

From: ToddAndMargo via perl6-users 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)



2025-04-11T06:20:09Z
Re: I need help with .IO.d.Bool by ToddAndMargo via perl6-users

From: ToddAndMargo via perl6-users On 4/5/25 6:58 PM, ToddAndMargo via perl6-users wrote:
> sub Directory

I changed the name to DirectoryExists

The new name is more human friendly

2025-04-06T09:47:57Z
Re: I need help with .IO.d.Bool by ToddAndMargo via perl6-users

From: ToddAndMargo via perl6-users On 4/2/25 6:08 PM, Bruce Gray wrote:
>
>
>> On Apr 2, 2025, at 19:47, ToddAndMargo via perl6-users <perl6-users@perl.org> wrote:
>
> --snip--
>
>> raku -e "say '\\192.168.240.10\oldserver\Backup\MyDocsBackup\backup1'.IO.d.Bool;"
>> False
>
> --snip--
>
> Moving this one-liner into a .raku file (to remove the complication of Windows needing double-quotes for our `-e`), and removing `.IO.d.Bool`, I ran just this line:
> say '\\192.168.240.10\oldserver\Backup\MyDocsBackup\backup1';
> The output is:
> \192.168.240.10\oldserver\Backup\MyDocsBackup\backup1
> So, the initial two backslashes are becoming a single backslash.
> You need a quoting that does not special-case doubled backslashes (like the Q[] I have seen you use), or to enter the path with initial quadruple backslashes.
>
> Does changing your one-liner to this:
> raku -e "say Q[\\192.168.240.10\oldserver\Backup\MyDocsBackup\backup1].IO.d.Bool;"
> fix the problem?
> If not, remove the `.Bool` just for a test run. You might still get False (like if the path exists but is not a directory), or you might get a Exception that gives you more detail of what is going wrong (like `Failed to find ...`, with the exact path that it was *actually* looking for).
>


Hi Bruce,

I need the function to operate with the exact path
assigned by Windows. No adding or subtracting.

This was my work around:


sub Directory( Str $DriveDirectory ) returns Bool is export( :Directory ) {
# True if a Directory or Drive Letter

my Str $RtnStr = RunCmd( "powershell.exe test-path -Path " ~ Q["]
~ $DriveDirectory ~ Q["] ~ " -PathType Container", True );
# print "RtnStr = <$RtnStr>\n";
if $RtnStr.lc.starts-with( "true" ) { return True; } else { return
False; }
}


Notice that I did not have to mess the `$DriveDirectory`?

.IO.d.Bool needs to do the same.

Let me know if you want the code for `RunCmd`.

Thank you for the help,
-T


2025-04-06T01:59:10Z
Re: I need help with .IO.d.Bool by Bruce Gray

From: Bruce Gray

> On Apr 2, 2025, at 19:47, ToddAndMargo via perl6-users <perl6-users@perl.org> wrote:

--snip--

> raku -e "say '\\192.168.240.10\oldserver\Backup\MyDocsBackup\backup1'.IO.d.Bool;"
> False

--snip--

Moving this one-liner into a .raku file (to remove the complication of Windows needing double-quotes for our `-e`), and removing `.IO.d.Bool`, I ran just this line:
say '\\192.168.240.10\oldserver\Backup\MyDocsBackup\backup1';
The output is:
\192.168.240.10\oldserver\Backup\MyDocsBackup\backup1
So, the initial two backslashes are becoming a single backslash.
You need a quoting that does not special-case doubled backslashes (like the Q[] I have seen you use), or to enter the path with initial quadruple backslashes.

Does changing your one-liner to this:
raku -e "say Q[\\192.168.240.10\oldserver\Backup\MyDocsBackup\backup1].IO.d.Bool;"
fix the problem?
If not, remove the `.Bool` just for a test run. You might still get False (like if the path exists but is not a directory), or you might get a Exception that gives you more detail of what is going wrong (like `Failed to find ...`, with the exact path that it was *actually* looking for).

--
Hope this helps,
Bruce Gray (Util of PerlMonks)

2025-04-06T00:14:32Z
Re: rename and unc by ToddAndMargo via perl6-users

From: ToddAndMargo via perl6-users > On Thu, Apr 3, 2025 at 2:14 AM ToddAndMargo via perl6-users <perl6-
> users@perl.org <mailto:perl6-users@perl.org>> wrote:
>
> And another IO ffunctio that does ot work:
>
> RotateArchives: renaming directory
> \\192.168.240.10\oldserver\Backup\MyDocsBackup\backup6 to
> \\192.168.240.10\oldserver\Backup\MyDocsBackup\backup4
>
> Failed to rename
> 'C:\192.168.240.10\oldserver\Backup\MyDocsBackup\backup6' to
> 'C:\192.168.240.10\oldserver\Backup\MyDocsBackup\backup4': Failed to
> rename file: no such file or directory
>
> rename put a freaking C: on teh unc path.
>
> Another call to powershell. Poop!
>
>
On 4/3/25 12:08 PM, yary wrote:
> The first 3 characters of the error is telling you the problem
>
> C:\192
>
> it's same as in another thread, use Q[\\192 ... instead of '\\192 ... ,
> so that you preserve the backslashes.

That other thread had that path in a variable. Raku messed
with the variable when I made the IO call. And I
can not put a variable into a Q[]. AAAAAA HHHH !!!!

> OR
>
> double each backslash- `\\\\192.168.240.10\\oldserver ... and then you
> can keep using variables as you normally do.
>
> -y

Hi Yary,

This is a glaring bug.

The call was
rename $Oldpath $NewPath

$OldPath was `\\192.168.240.10\oldserver\Backup\MyDocsBackup\backup6`
$NewPath was `\\192.168.240.10\oldserver\Backup\MyDocsBackup\backup4`

Once I have something added to a variable, it is HANDS OFF. DO
NOT MESS WITH IT. Before then, it is appreciated. BUT NOT AFTER!

Not only did rename mess with my variables, but it added `C:` to it.

If the powers-that-be ever decide to fix IO under Windows, any
workaround I do to get around the current situation will
be broken. And back to chasing ghosts again.

My solution is to add powershell calls to my NativeWinUtils.rakumod
and use them instead of raku's IO calls.

An example:

sub DirectoryExists( Str $DirPath --> Bool ) {
# $Full DirPath format is
\\192.168.240.10\oldserver\Backup\MyDocsBackup\backup
my $SubName = &?ROUTINE.name;
my Str $RtnStr = RunCmd "powershell Test-Path $DirPath", True;
$RtnStr = $RtnStr.chomp;
if $CommandLine.debug { print "$SubName: powershell Test-Path
returned <$RtnStr> for <$DirPath>\n\n"; }
if $RtnStr.lc.contains( "true" ) { return True; } else { return
False; }
}

Oh ya, and the above actually works!

Forgive my being crabby. I have been coding on this project
for over a week. It was only suppose to take a day. I have
been CHASING GHOSTS. I am really, really tired. Now I have
to remove all of the IO calls from my code and replace them
with calls to powershell. AAAA HHHH !!!!!! At least I
have finally figured out what was going wrong.

Thank you for the help!

-T






2025-04-04T02:06:04Z
Re: unc "for" bug by ToddAndMargo via perl6-users <p>From: ToddAndMargo via perl6-users <br/>&gt;&gt; On Wed, Apr 2, 2025 at 11:37&#x202F;PM ToddAndMargo via perl6-users &lt;perl6- <br/>&gt;&gt; users@perl.org &lt;mailto:perl6-users@perl.org&gt;&gt; wrote:<br/>&gt;&gt; <br/>&gt;&gt; Hi All,<br/>&gt;&gt; <br/>&gt;&gt; Windows Server 2025 (souped up W11)<br/>&gt;&gt; <br/>&gt;&gt; raku -v<br/>&gt;&gt; Welcome to Rakudo&Gamma;&auml;&oacute; v2025.02.<br/>&gt;&gt; <br/>&gt;&gt; Now this has to be a bug!<br/>&gt;&gt; <br/>&gt;&gt; Good result:<br/>&gt;&gt; <br/>&gt;&gt; raku -e &quot;for dir Q[C:\NtUtil] -&gt; $i {say $i.Str;}&quot;<br/>&gt;&gt; C:\NtUtil\2025-03-31<br/>&gt;&gt; C:\NtUtil\CobianWrapper.raku<br/>&gt;&gt; C:\NtUtil\getopstest.raku<br/>&gt;&gt; C:\NtUtil\LinuxServerMount.bat<br/>&gt;&gt; C:\NtUtil\mail.txt<br/>&gt;&gt; C:\NtUtil\MailTest.raku<br/>&gt;&gt; etc.<br/>&gt;&gt; <br/>&gt;&gt; Bad result:<br/>&gt;&gt; raku -e &quot;for dir Q[\\192.168.240.10\oldserver\Backup\MyDocsBackup]<br/>&gt;&gt; -&gt; $i {say $i.Str;}&quot;<br/>&gt;&gt; \\192.168.240.10\oldserver\Backup\MyDocsBackup\backup1<br/>&gt;&gt; &lt;missing two more entries&gt;<br/>&gt;&gt; <br/>&gt;&gt; <br/>&gt;&gt; Powershell:<br/>&gt;&gt; powershell.exe Get-ChildItem -Path<br/>&gt;&gt; &quot;\\192.168.240.10\oldserver\Backup\MyDocsBackup&quot;<br/>&gt;&gt; <br/>&gt;&gt; Directory: \\192.168.240.10\oldserver\Backup\MyDocsBackup<br/>&gt;&gt; <br/>&gt;&gt; Mode LastWriteTime Length Name<br/>&gt;&gt; ---- ------------- ------ ----<br/>&gt;&gt; d----- 3/31/2025 5:47 PM backup3<br/>&gt;&gt; d----- 3/31/2025 5:57 PM backup2<br/>&gt;&gt; d----- 4/2/2025 6:39 PM backup1<br/>&gt;&gt; <br/>&gt;&gt; <br/>&gt;&gt; Am I crazy or is Raku IO corked in Windows when dealing with UNC paths?<br/>&gt;&gt; <br/>&gt;&gt; -T<br/>&gt;&gt; <br/>&gt;&gt; <br/><br/><br/>On 4/3/25 12:02 PM, yary wrote:<br/>&gt; What does cmd shell output from<br/>&gt; <br/>&gt; dir \\192.168.240.10\oldserver\Backup\MyDocsBackup<br/>&gt; <br/>&gt; ?<br/>&gt; <br/>&gt; -y<br/><br/>dir \\192.168.240.10\oldserver\Backup\MyDocsBackup<br/> Volume in drive \\192.168.240.10\oldserver is Fedora Core, 4.21.4<br/> Volume Serial Number is 11CC-67DD<br/><br/> Directory of \\192.168.240.10\oldserver\Backup\MyDocsBackup<br/><br/>04/02/2025 10:23 PM &lt;DIR&gt; .<br/>03/19/2025 05:16 PM &lt;DIR&gt; ..<br/>04/02/2025 10:23 PM &lt;DIR&gt; backup6<br/>03/31/2025 05:57 PM &lt;DIR&gt; backup22<br/>04/02/2025 10:21 PM &lt;DIR&gt; backup3<br/>04/02/2025 10:16 PM &lt;DIR&gt; backup2<br/>04/02/2025 10:12 PM &lt;DIR&gt; backup11<br/>04/02/2025 06:39 PM &lt;DIR&gt; backup1<br/> 0 File(s) 0 bytes<br/> 8 Dir(s) 1,720,569,331,712 bytes free<br/><br/>I&#39;ve added some directories since the first posting.<br/><br/><br/><br/></p> 2025-04-04T01:11:36Z Re: rename and unc by yary <p>From: yary The first 3 characters of the error is telling you the problem <br/> <br/>C:\192 <br/> <br/>it&#39;s same as in another thread, use Q[\\192 ... instead of &#39;\\192 ... , so <br/>that you preserve the backslashes. <br/> <br/>OR <br/> <br/>double each backslash- `\\\\192.168.240.10\\oldserver ... and then you can <br/>keep using variables as you normally do. <br/> <br/>-y <br/> <br/> <br/>On Thu, Apr 3, 2025 at 2:14&acirc;&#128;&macr;AM ToddAndMargo via perl6-users &lt; <br/>perl6-users@perl.org&gt; wrote: <br/> <br/>&gt; And another IO ffunctio that does ot work: <br/>&gt; <br/>&gt; RotateArchives: renaming directory <br/>&gt; \\192.168.240.10\oldserver\Backup\MyDocsBackup\backup6 to <br/>&gt; \\192.168.240.10\oldserver\Backup\MyDocsBackup\backup4 <br/>&gt; <br/>&gt; Failed to rename <br/>&gt; &#39;C:\192.168.240.10\oldserver\Backup\MyDocsBackup\backup6&#39; to <br/>&gt; &#39;C:\192.168.240.10\oldserver\Backup\MyDocsBackup\backup4&#39;: Failed to <br/>&gt; rename file: no such file or directory <br/>&gt; <br/>&gt; rename put a freaking C: on teh unc path. <br/>&gt; <br/>&gt; Another call to powershell. Poop! <br/>&gt; <br/>&gt; <br/>&gt; <br/></p> 2025-04-03T19:08:21Z Re: unc "for" bug by yary <p>From: yary What does cmd shell output from <br/> <br/>dir \\192.168.240.10\oldserver\Backup\MyDocsBackup <br/> <br/>? <br/> <br/>-y <br/> <br/> <br/>On Wed, Apr 2, 2025 at 11:37&acirc;&#128;&macr;PM ToddAndMargo via perl6-users &lt; <br/>perl6-users@perl.org&gt; wrote: <br/> <br/>&gt; Hi All, <br/>&gt; <br/>&gt; Windows Server 2025 (souped up W11) <br/>&gt; <br/>&gt; raku -v <br/>&gt; Welcome to Rakudo&Icirc;&#147;&Atilde;&curren;&Atilde;&sup3; v2025.02. <br/>&gt; <br/>&gt; Now this has to be a bug! <br/>&gt; <br/>&gt; Good result: <br/>&gt; <br/>&gt; raku -e &quot;for dir Q[C:\NtUtil] -&gt; $i {say $i.Str;}&quot; <br/>&gt; C:\NtUtil\2025-03-31 <br/>&gt; C:\NtUtil\CobianWrapper.raku <br/>&gt; C:\NtUtil\getopstest.raku <br/>&gt; C:\NtUtil\LinuxServerMount.bat <br/>&gt; C:\NtUtil\mail.txt <br/>&gt; C:\NtUtil\MailTest.raku <br/>&gt; etc. <br/>&gt; <br/>&gt; Bad result: <br/>&gt; raku -e &quot;for dir Q[\\192.168.240.10\oldserver\Backup\MyDocsBackup] <br/>&gt; -&gt; $i {say $i.Str;}&quot; <br/>&gt; \\192.168.240.10\oldserver\Backup\MyDocsBackup\backup1 <br/>&gt; &lt;missing two more entries&gt; <br/>&gt; <br/>&gt; <br/>&gt; Powershell: <br/>&gt; powershell.exe Get-ChildItem -Path <br/>&gt; &quot;\\192.168.240.10\oldserver\Backup\MyDocsBackup&quot; <br/>&gt; <br/>&gt; Directory: \\192.168.240.10\oldserver\Backup\MyDocsBackup <br/>&gt; <br/>&gt; Mode LastWriteTime Length Name <br/>&gt; ---- ------------- ------ ---- <br/>&gt; d----- 3/31/2025 5:47 PM backup3 <br/>&gt; d----- 3/31/2025 5:57 PM backup2 <br/>&gt; d----- 4/2/2025 6:39 PM backup1 <br/>&gt; <br/>&gt; <br/>&gt; Am I crazy or is Raku IO corked in Windows when dealing with UNC paths? <br/>&gt; <br/>&gt; -T <br/>&gt; <br/>&gt; <br/>&gt; <br/></p> 2025-04-03T19:03:10Z The SF Perl Raku Study Group, 04/06 at 1pm PST by Joseph Brenner

From: Joseph Brenner The Raku Study Group

"This time for sure!" -- Bullwinkle J. Moose

April 6th, 2025 1pm in California, 8pm in the UK

An informal meeting: drop by when you can, show us what you've got,
ask and answer questions, or just listen and lurk.

Perl and programming in general are fair game, along with Raku,

Zoom meeting link:
https://us02web.zoom.us/j/89759925908?pwd=59mwQboALSjiFQB9tdT2DDd4Xkxdi8.1

Passcode: 4RakuRoll

2025-04-03T08:29:58Z
rename and unc by ToddAndMargo via perl6-users

From: ToddAndMargo via perl6-users And another IO ffunctio that does ot work:

RotateArchives: renaming directory
\\192.168.240.10\oldserver\Backup\MyDocsBackup\backup6 to
\\192.168.240.10\oldserver\Backup\MyDocsBackup\backup4

Failed to rename
'C:\192.168.240.10\oldserver\Backup\MyDocsBackup\backup6' to
'C:\192.168.240.10\oldserver\Backup\MyDocsBackup\backup4': Failed to
rename file: no such file or directory

rename put a freaking C: on teh unc path.

Another call to powershell. Poop!


2025-04-03T06:14:20Z
Re: I need help with .IO.d.Bool by ToddAndMargo via perl6-users

From: ToddAndMargo via perl6-users On 4/2/25 9:53 PM, ToddAndMargo via perl6-users wrote:
> On 4/2/25 6:26 PM, Will Coleda wrote:
>> Try printing the Str before you do anything with it to see what happens.
>
>
> I moved to powershell

I mean I did a call to powershell to find if a directory existed

2025-04-03T05:24:44Z
Re: I need help with .IO.d.Bool by ToddAndMargo via perl6-users

From: ToddAndMargo via perl6-users On 4/2/25 6:26 PM, Will Coleda wrote:
> Try printing the Str before you do anything with it to see what happens.


I moved to powershell

2025-04-03T04:54:05Z
Re: I need help with .IO.d.Bool by ToddAndMargo via perl6-users

From: ToddAndMargo via perl6-users On 4/2/25 6:08 PM, Bruce Gray wrote:
>
>
>> On Apr 2, 2025, at 19:47, ToddAndMargo via perl6-users <perl6-users@perl.org> wrote:
>
> --snip--
>
>> raku -e "say '\\192.168.240.10\oldserver\Backup\MyDocsBackup\backup1'.IO.d.Bool;"
>> False
>
> --snip--
>
> Moving this one-liner into a .raku file (to remove the complication of Windows needing double-quotes for our `-e`), and removing `.IO.d.Bool`, I ran just this line:
> say '\\192.168.240.10\oldserver\Backup\MyDocsBackup\backup1';
> The output is:
> \192.168.240.10\oldserver\Backup\MyDocsBackup\backup1
> So, the initial two backslashes are becoming a single backslash.
> You need a quoting that does not special-case doubled backslashes (like the Q[] I have seen you use), or to enter the path with initial quadruple backslashes.
>
> Does changing your one-liner to this:
> raku -e "say Q[\\192.168.240.10\oldserver\Backup\MyDocsBackup\backup1].IO.d.Bool;"
> fix the problem?

Yes.

raku -e "say
Q[\\192.168.240.10\oldserver\Backup\MyDocsBackup\backup1].IO.d.Bool;"
True

raku -e "say
Q[\\192.168.240.10\oldserver\Backup\MyDocsBackup\backup10].IO.d.Bool;"
False

Now how do I encode a variable inside a Q[]?



> If not, remove the `.Bool` just for a test run. You might still get False (like if the path exists but is not a directory), or you might get a Exception that gives you more detail of what is going wrong (like `Failed to find ...`, with the exact path that it was *actually* looking for).
>

2025-04-03T03:39:59Z
unc "for" bug by ToddAndMargo via perl6-users <p>From: ToddAndMargo via perl6-users Hi All,<br/><br/>Windows Server 2025 (souped up W11)<br/><br/>raku -v<br/>Welcome to Rakudo&Gamma;&auml;&oacute; v2025.02.<br/><br/>Now this has to be a bug!<br/><br/>Good result:<br/><br/> raku -e &quot;for dir Q[C:\NtUtil] -&gt; $i {say $i.Str;}&quot;<br/> C:\NtUtil\2025-03-31<br/> C:\NtUtil\CobianWrapper.raku<br/> C:\NtUtil\getopstest.raku<br/> C:\NtUtil\LinuxServerMount.bat<br/> C:\NtUtil\mail.txt<br/> C:\NtUtil\MailTest.raku<br/> etc.<br/><br/>Bad result:<br/> raku -e &quot;for dir Q[\\192.168.240.10\oldserver\Backup\MyDocsBackup] <br/>-&gt; $i {say $i.Str;}&quot;<br/> \\192.168.240.10\oldserver\Backup\MyDocsBackup\backup1<br/>&lt;missing two more entries&gt;<br/><br/><br/>Powershell:<br/> powershell.exe Get-ChildItem -Path <br/>&quot;\\192.168.240.10\oldserver\Backup\MyDocsBackup&quot;<br/><br/> Directory: \\192.168.240.10\oldserver\Backup\MyDocsBackup<br/><br/> Mode LastWriteTime Length Name<br/> ---- ------------- ------ ----<br/> d----- 3/31/2025 5:47 PM backup3<br/> d----- 3/31/2025 5:57 PM backup2<br/> d----- 4/2/2025 6:39 PM backup1<br/><br/><br/>Am I crazy or is Raku IO corked in Windows when dealing with UNC paths?<br/><br/>-T<br/><br/><br/></p> 2025-04-03T03:37:21Z Re: I need help with .IO.d.Bool by Will Coleda <p>From: Will Coleda Try printing the Str before you do anything with it to see what happens. <br/> <br/>(Hint - the backslash character escapes characters in literal strings) <br/> <br/>On Wed, Apr 2, 2025 at 8:47&acirc;&#128;&macr;PM ToddAndMargo via perl6-users &lt; <br/>perl6-users@perl.org&gt; wrote: <br/> <br/>&gt; Hi All, <br/>&gt; <br/>&gt; Windows Server 2025 (souped up W11) <br/>&gt; <br/>&gt; raku -v <br/>&gt; Welcome to Rakudo&Icirc;&#147;&Atilde;&curren;&Atilde;&sup3; v2025.02. <br/>&gt; <br/>&gt; I am trying to see if this directory exists: <br/>&gt; \\192.168.240.10\oldserver\Backup\MyDocsBackup\backup1 <br/>&gt; <br/>&gt; This is what raku .IO.d.Bool give me: <br/>&gt; raku -e &quot;say <br/>&gt; &#39;\\192.168.240.10\oldserver\Backup\MyDocsBackup\backup1&#39;.IO.d.Bool;&quot; <br/>&gt; False <br/>&gt; <br/>&gt; But power shell says it does me: <br/>&gt; powershell Test-Path <br/>&gt; \\192.168.240.10\oldserver\Backup\MyDocsBackup\backup1 <br/>&gt; True <br/>&gt; <br/>&gt; From \\192.168.240.10, (a Samba server), it also tells me the <br/>&gt; directory indeed does exist: <br/>&gt; <br/>&gt; # ls -al /mnt/LinuxServer/Backup/MyDocsBackup <br/>&gt; total 36 <br/>&gt; drwxrwsrwx. 5 public root 4096 Mar 31 18:37 . <br/>&gt; drwxrwsrwx. 5 root root 4096 Mar 19 17:16 .. <br/>&gt; drwxrwsrwx. 4 public root 4096 Mar 31 18:37 backup1 <br/>&gt; drwxrwsrwx. 4 public root 4096 Mar 31 17:57 backup2 <br/>&gt; drwxrwsrwx. 4 public root 4096 Mar 31 17:47 backup3 <br/>&gt; <br/>&gt; <br/>&gt; What am I doing wrong? <br/>&gt; <br/>&gt; Many thanks, <br/>&gt; -T <br/>&gt; <br/>&gt; <br/>&gt; <br/></p> 2025-04-03T01:27:07Z I need help with .IO.d.Bool by ToddAndMargo via perl6-users <p>From: ToddAndMargo via perl6-users Hi All,<br/><br/>Windows Server 2025 (souped up W11)<br/><br/>raku -v<br/>Welcome to Rakudo&Gamma;&auml;&oacute; v2025.02.<br/><br/>I am trying to see if this directory exists:<br/> \\192.168.240.10\oldserver\Backup\MyDocsBackup\backup1<br/><br/>This is what raku .IO.d.Bool give me:<br/> raku -e &quot;say <br/>&#39;\\192.168.240.10\oldserver\Backup\MyDocsBackup\backup1&#39;.IO.d.Bool;&quot;<br/> False<br/><br/>But power shell says it does me:<br/> powershell Test-Path <br/>\\192.168.240.10\oldserver\Backup\MyDocsBackup\backup1<br/> True<br/><br/> From \\192.168.240.10, (a Samba server), it also tells me the<br/>directory indeed does exist:<br/><br/> # ls -al /mnt/LinuxServer/Backup/MyDocsBackup<br/> total 36<br/> drwxrwsrwx. 5 public root 4096 Mar 31 18:37 .<br/> drwxrwsrwx. 5 root root 4096 Mar 19 17:16 ..<br/> drwxrwsrwx. 4 public root 4096 Mar 31 18:37 backup1<br/> drwxrwsrwx. 4 public root 4096 Mar 31 17:57 backup2<br/> drwxrwsrwx. 4 public root 4096 Mar 31 17:47 backup3<br/><br/><br/>What am I doing wrong?<br/><br/>Many thanks,<br/>-T<br/><br/><br/></p> 2025-04-03T00:47:30Z Re: I need help with get-options by ToddAndMargo via perl6-users <p>From: ToddAndMargo via perl6-users On 4/2/25 8:22 AM, Bruce Gray wrote:<br/><br/>&gt;&gt; my $CommandLine = CommandLineClass.new{<br/>&gt;&gt; &nbsp;&nbsp;&nbsp;help &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&gt; False,<br/>&gt;&gt; &nbsp;&nbsp;&nbsp;debug &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&gt; False,<br/>&gt;&gt; &nbsp;&nbsp;&nbsp;UNC_BackupPath =&gt; Q[\\192.168.240.10\MyDocsBackup\backup1],<br/>&gt;&gt; &nbsp;&nbsp;&nbsp;rotates &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&gt; 2,<br/>&gt;&gt; &nbsp;&nbsp;&nbsp;ParentDir &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&gt; &quot;/&quot;<br/>&gt;&gt; };<br/>&gt; <br/>&gt; The problem is with the syntax of the `new`.<br/>&gt; You need parenthesis instead of curly braces.<br/>&gt; With that change, your code works as expected.<br/><br/>And I have it right on every other .new in my code.<br/>Even my keeper how to has it right. Mumble, Mumble.<br/><br/>Question: should the compiler have caught this? Or<br/>is there some other purpose for the .new{} syntax?<br/><br/>&gt; <br/>&gt; For even DRYer code, you can flatten `%opts` directly into the `new` <br/>&gt; constructor, like so:<br/>&gt; &nbsp; &nbsp; # use lib &#39;C:/NtUtil&#39;, &#39;C:/NtUtil/p6lib&#39;; &nbsp; # use this one on <br/>&gt; customer machines<br/>&gt; &nbsp; &nbsp; use Getopt::Long;<br/>&gt; &nbsp; &nbsp; class CommandLineClass is rw {<br/>&gt; &nbsp; &nbsp; &nbsp; &nbsp; has Bool $.help &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = False;<br/>&gt; &nbsp; &nbsp; &nbsp; &nbsp; has Bool $.debug &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= False;<br/>&gt; &nbsp; &nbsp; &nbsp; &nbsp; has Str &nbsp;$.UNC_BackupPath = Q[\ <br/>&gt; \192.168.240.10\MyDocsBackup\backup1];<br/>&gt; &nbsp; &nbsp; &nbsp; &nbsp; has Int &nbsp;$.rotates &nbsp; &nbsp; &nbsp; &nbsp;= 2;<br/>&gt; &nbsp; &nbsp; &nbsp; &nbsp; has &nbsp; &nbsp; &nbsp;$.ParentDir &nbsp; &nbsp; &nbsp;= &#39;/&#39;;<br/>&gt; &nbsp; &nbsp; }<br/>&gt; &nbsp; &nbsp; my %opts = get-options( &#39;help&#39;, &#39;debug&#39;, &#39;UNC_BackupPath=s&#39;, <br/>&gt; &#39;rotates=i&#39;, &#39;ParentDir=s&#39; ).hash;<br/>&gt; &nbsp; &nbsp; my CommandLineClass $CommandLine .= new( |%opts );<br/>&gt; &nbsp; &nbsp; say $CommandLine.raku if $CommandLine.debug;<br/><br/>Sweet!<br/><br/>&gt; <br/>&gt; -- <br/>&gt; Hope this helps,<br/>&gt; Bruce Gray (Util of PerlMonks)<br/><br/><br/>Very much so! Thank you!<br/><br/></p> 2025-04-02T21:13:03Z Re: I need help with get-options by Bruce Gray

From: Bruce Gray

> On Apr 2, 2025, at 05:47, ToddAndMargo via perl6-users <perl6-users@perl.org> wrote:

--snip--

> Hi Bruce,
>
> Sorry. I do know I am suppose to post some minimal code.
> I was programming for 11 straight hours and was not
> thinking too clearly.

I understand.

> I was trying to do what you said. Read it into a hash, then
> extract the values into an OOP structure. (I use to like
> hashes, but dropped them hard when I figured out OOP
> structures. I absolutely A-D-O-R-E OOP structures.)
>
> Thank you again for the help!
> -T

--snip--


> my $CommandLine = CommandLineClass.new{
> help => False,
> debug => False,
> UNC_BackupPath => Q[\\192.168.240.10\MyDocsBackup\backup1],
> rotates => 2,
> ParentDir => "/"
> };

The problem is with the syntax of the `new`.
You need parenthesis instead of curly braces.
With that change, your code works as expected.

For even DRYer code, you can flatten `%opts` directly into the `new` constructor, like so:
# use lib 'C:/NtUtil', 'C:/NtUtil/p6lib'; # use this one on customer machines
use Getopt::Long;
class CommandLineClass is rw {
has Bool $.help = False;
has Bool $.debug = False;
has Str $.UNC_BackupPath = Q[\\192.168.240.10\MyDocsBackup\backup1];
has Int $.rotates = 2;
has $.ParentDir = '/';
}
my %opts = get-options( 'help', 'debug', 'UNC_BackupPath=s', 'rotates=i', 'ParentDir=s' ).hash;
my CommandLineClass $CommandLine .= new( |%opts );
say $CommandLine.raku if $CommandLine.debug;

--
Hope this helps,
Bruce Gray (Util of PerlMonks)

2025-04-02T15:22:54Z
Re: I need help with get-options by ToddAndMargo via perl6-users <p>From: ToddAndMargo via perl6-users On 4/1/25 4:04 PM, Bruce Gray wrote:<br/>&gt; <br/>&gt; <br/>&gt;&gt; On Apr 1, 2025, at 03:55, ToddAndMargo via perl6-users &lt;perl6-users@perl.org&gt; wrote:<br/>&gt; <br/>&gt; --snip--<br/>&gt; <br/>&gt;&gt; I have the following run string:<br/>&gt;&gt; raku C:\NtUtil\RLA.Backup.raku --rotates 345 --UNC_BackupPath \\192.168.240.10\Backup\MyDocsBackup\backup1 --debug<br/>&gt;&gt;<br/>&gt;&gt;<br/>&gt;&gt; use Getopt::Long; # get-options<br/>&gt;&gt; get-options(&#39;debug&#39; =&gt; $CommandLine.debug );<br/>&gt;&gt;<br/>&gt;&gt; error out with<br/>&gt;&gt; No such method &#39;debug&#39; for invocant of type &#39;List&#39;<br/>&gt;&gt;<br/>&gt;&gt; What am I doing wrong?<br/>&gt; <br/>&gt; You are not giving us a https://en.wikipedia.org/wiki/Minimal_reproducible_example , so I am having to guess.<br/>&gt; My guess is that you have defined `$CommandLine` in a way that lacks a writeable `.debug` method.<br/>&gt; <br/>&gt; You *could* simplify the call to `get-options` to use a simple temp variables (similar to the documentation), then copy the temp into some `debug` and similar parts of your more complex `$CommandLine` data structure, but I expect your full code is trying to avoid such temp vars.<br/>&gt; <br/>&gt; Here is a complete runnable program to demonstrate skipping any temp vars, using a wild guess that `$CommandLine` is the sole instance of a OO data class:<br/>&gt; <br/>&gt; class CommandLineInfo {<br/>&gt; has Bool $.debug is rw = False;<br/>&gt; }<br/>&gt; <br/>&gt; my CommandLineInfo $CommandLine .= new;<br/>&gt; <br/>&gt; use Getopt::Long;<br/>&gt; get-options( &#39;debug&#39; =&gt; $CommandLine.debug );<br/>&gt; <br/>&gt; say $CommandLine.debug; # Will be `True` or `False`, depending on command-line arg.<br/>&gt; <br/>&gt; If this code does not align with (and is not adaptable to) your use case, we (or at least *I*) will need more information from you, especially the definition of `$CommandLine` in your current code.<br/>&gt; As always, minimal *runnable* code will allow any of us to provide an answer to you more quickly.<br/>&gt; <br/>&gt; FWIW, I use `sub MAIN`, but if I were to use `Getopt::Long`, I might use the (under-documented) method of having `get-options` build the data structure itself:<br/>&gt; use Getopt::Long;<br/>&gt; my %CommandLine = get-options( &#39;debug&#39;, &#39;rotates=i&#39;, &#39;UNC_BackupPath=p&#39; ).hash;<br/>&gt; say ?%CommandLine&lt;debug&gt;; # Just the `debug` argument, forced to Bool<br/>&gt; say %CommandLine.raku; # All the specified arguments.<br/>&gt; <br/>&gt; <br/>&gt;&gt; Many thanks,<br/>&gt;&gt; -T<br/>&gt; <br/>&gt; You are very welcome!<br/><br/><br/>Hi Bruce,<br/><br/>Sorry. I do know I am suppose to post some minimal code.<br/>I was programming for 11 straight hours and was not<br/>thinking too clearly.<br/><br/>I was trying to do what you said. Read it into a hash, then<br/>extract the values into an OOP structure. (I use to like<br/>hashes, but dropped them hard when I figured out OOP<br/>structures. I absolutely A-D-O-R-E OOP structures.)<br/><br/>Thank you again for the help!<br/>-T<br/><br/><br/>Windows Server 2025 (souped up W11)<br/><br/>raku -v<br/>Welcome to Rakudo&Gamma;&auml;&oacute; v2025.02.<br/>Implementing the Raku&#x252C;&laquo; Programming Language v6.d.<br/>Built on MoarVM version 2025.02.<br/><br/>https://raku.land/cpan:LEONT/Getopt::Long<br/><br/><br/>&lt;getopstest.raku&gt;<br/>#!/usr/bin/env raku<br/><br/>use lib &#39;C:/NtUtil&#39;, &#39;C:/NtUtil/p6lib&#39;; # use this one on customer <br/>machines<br/>use Getopt::Long; # get-options<br/><br/><br/>class CommandLineClass {<br/> has Bool $.help is rw;<br/> has Bool $.debug is rw;<br/> has Str $.UNC_BackupPath is rw;<br/> has Int $.rotates is rw;<br/> has $.ParentDir is rw;<br/>}<br/><br/>my $CommandLine = CommandLineClass.new{<br/> help =&gt; False,<br/> debug =&gt; False,<br/> UNC_BackupPath =&gt; Q[\\192.168.240.10\MyDocsBackup\backup1],<br/> rotates =&gt; 2,<br/> ParentDir =&gt; &quot;/&quot;<br/>};<br/><br/><br/># raku getopstest.raku --rotates 456 --UNC_BackupPath <br/>\\192.168.240.235\MyDocsBackup\\backup1 --help --debug<br/><br/>my %opts;<br/># %opts = ( &#39;help&#39; =&gt; False, &#39;debug&#39; =&gt; False, &#39;UNC_BackupPath=s&#39; =&gt; <br/>&quot;&quot;, &#39;rotates=i&#39; =&gt; 0 );<br/><br/><br/># %opts = get-options( %opts ).hash;<br/>%opts = get-options( &#39;help&#39;, &#39;debug&#39;, &#39;UNC_BackupPath=s&#39;, &#39;rotates=i&#39; <br/>).hash;<br/>say &quot;\%opts =\n&quot; ~ %opts ~ &quot;\n&quot;;<br/><br/>$CommandLine.UNC_BackupPath = %opts&lt;UNC_BackupPath&gt;.Str;<br/>$CommandLine.help = %opts&lt;help&gt;;<br/>$CommandLine.debug = %opts&lt;debug&gt;;<br/>$CommandLine.rotates = %opts&lt;rotates&gt;.Int;<br/><br/>if $CommandLine.debug {<br/> print $CommandLine.help ~ &quot;\n&quot;;<br/> print $CommandLine.debug ~ &quot;\n&quot;;<br/> print $CommandLine.UNC_BackupPath ~ &quot;\n&quot;;<br/> print $CommandLine.rotates ~ &quot;\n&quot;;<br/>}<br/>&lt;/getopstest.raku&gt;<br/><br/><br/>C:\NtUtil&gt;raku getopstest.raku --rotates 456 --UNC_BackupPath <br/>\\192.168.240.235\MyDocsBackup\\backup1 --help --debug<br/><br/>%opts =<br/>UNC_BackupPath \\192.168.240.235\MyDocsBackup\\backup1<br/>debug True<br/>help True<br/>rotates 456<br/><br/>No such method &#39;UNC_BackupPath&#39; for invocant of type &#39;List&#39;<br/> in method throw at &#39;SETTING::&#39;src/core.c/Exception.rakumod line 65<br/> in block &lt;unit&gt; at getopstest.raku line 34<br/><br/>Line 34 is<br/> $CommandLine.UNC_BackupPath = %opts&lt;UNC_BackupPath&gt;.Str;<br/><br/>Line 34-37 all give the same error if I comment out the ones<br/>above them<br/><br/></p> 2025-04-02T10:47:21Z Re: I need help with get-options by Bruce Gray

From: Bruce Gray

> On Apr 1, 2025, at 03:55, ToddAndMargo via perl6-users <perl6-users@perl.org> wrote:

--snip--

> I have the following run string:
> raku C:\NtUtil\RLA.Backup.raku --rotates 345 --UNC_BackupPath \\192.168.240.10\Backup\MyDocsBackup\backup1 --debug
>
>
> use Getopt::Long; # get-options
> get-options('debug' => $CommandLine.debug );
>
> error out with
> No such method 'debug' for invocant of type 'List'
>
> What am I doing wrong?

You are not giving us a https://en.wikipedia.org/wiki/Minimal_reproducible_example , so I am having to guess.
My guess is that you have defined `$CommandLine` in a way that lacks a writeable `.debug` method.

You *could* simplify the call to `get-options` to use a simple temp variables (similar to the documentation), then copy the temp into some `debug` and similar parts of your more complex `$CommandLine` data structure, but I expect your full code is trying to avoid such temp vars.

Here is a complete runnable program to demonstrate skipping any temp vars, using a wild guess that `$CommandLine` is the sole instance of a OO data class:

class CommandLineInfo {
has Bool $.debug is rw = False;
}

my CommandLineInfo $CommandLine .= new;

use Getopt::Long;
get-options( 'debug' => $CommandLine.debug );

say $CommandLine.debug; # Will be `True` or `False`, depending on command-line arg.

If this code does not align with (and is not adaptable to) your use case, we (or at least *I*) will need more information from you, especially the definition of `$CommandLine` in your current code.
As always, minimal *runnable* code will allow any of us to provide an answer to you more quickly.

FWIW, I use `sub MAIN`, but if I were to use `Getopt::Long`, I might use the (under-documented) method of having `get-options` build the data structure itself:
use Getopt::Long;
my %CommandLine = get-options( 'debug', 'rotates=i', 'UNC_BackupPath=p' ).hash;
say ?%CommandLine<debug>; # Just the `debug` argument, forced to Bool
say %CommandLine.raku; # All the specified arguments.


> Many thanks,
> -T

You are very welcome!
--
Bruce Gray (Util of PerlMonks)


2025-04-01T23:04:43Z
Re: I need help with get-options by ToddAndMargo via perl6-users

From: ToddAndMargo via perl6-users Should have said "I need help with get-options"


2025-04-01T09:02:57Z
I need help with by ToddAndMargo via perl6-users <p>From: ToddAndMargo via perl6-users Hi All,<br/><br/>Windows Server 2025 (souped up W11)<br/><br/>raku -v<br/>Welcome to Rakudo&Gamma;&auml;&oacute; v2025.02.<br/>Implementing the Raku&#x252C;&laquo; Programming Language v6.d.<br/>Built on MoarVM version 2025.02.<br/><br/>https://raku.land/cpan:LEONT/Getopt::Long<br/><br/><br/>I have the following run string:<br/>raku C:\NtUtil\RLA.Backup.raku --rotates 345 --UNC_BackupPath <br/>\\192.168.240.10\Backup\MyDocsBackup\backup1 --debug<br/><br/><br/>use Getopt::Long; # get-options<br/>get-options(&#39;debug&#39; =&gt; $CommandLine.debug );<br/><br/>error out with<br/> No such method &#39;debug&#39; for invocant of type &#39;List&#39;<br/><br/>What am I doing wrong?<br/><br/>Many thanks,<br/>-T<br/><br/></p> 2025-04-01T08:56:01Z The SF Perl Raku Study Group, 03/23 at 1pm PST by Joseph Brenner

From: Joseph Brenner Doug Hoyte, "Let Over Lambda-- 50 Years of Lisp" (2008):

"It must also be pointed out that aif and alambda, like all anaphoric
macros, violate lexical transparency. A fashionable way of saying this
is currently to say that they are unhygienic macros. That is, like a
good number of macros in this book, they invisibly introduce lexical
bindings and thus cannot be created with macro systems that strictly
enforce hygiene. Even the vast majority of Scheme systems, the
platform that has experimented the most with hygiene, provide
unhygienic defmacro-style macros-presumably because not even Scheme
implementors take hygiene very seriously. Like training wheels on a
bicycle, hygiene systems are for the most part toys that should be
discarded after even a modest level of skill has been acquired."

https://letoverlambda.com/index.cl/guest/chap6.html

The Raku Study Group

March 23, 2025 1pm in California, 8pm in the UK

An informal meeting: drop by when you can, show us what you've got,
ask and answer questions, or just listen and lurk.

Perl and programming in general are fair game, along with Raku,

Zoom meeting link:
https://us02web.zoom.us/j/81750169963?pwd=SY3gIr63jZtsXVgW4PDXwbOdLavt1c.1

Passcode: 4RakuRoll

2025-03-10T01:30:40Z
The SF Perl Raku Study Group, 03/09 at 1pm PST by Joseph Brenner

From: Joseph Brenner "There is no royal road to logic, and really valuable ideas can
only be had at the price of close attention. But I know that in
the matter of ideas the public prefer the cheap and nasty ... "

-- C.S. Pierce, "How to Make Our Ideas Clear" (1878)

The Raku Study Group

March 9, 2025 1pm in California, 9pm in the UK

An informal meeting: drop by when you can, show us what you've got,
ask and answer questions, or just listen and lurk.

Perl and programming in general are fair game, along with Raku,

Zoom meeting link:
https://us02web.zoom.us/j/85701010841?pwd=b6eclkW4hs35tWs8a4F7kJonKaxybe.1

Passcode: 4RakuRoll

2025-02-24T18:34:20Z
The SF Perl Raku Study Group, 02/23 at 1pm PST by Joseph Brenner

From: Joseph Brenner "I found my way in the dark by bouncing off of sharp objects,
as do we all." -- Algis Budrys

The Raku Study Group

February 23, 2025 1pm in California, 9pm in the UK

An informal meeting: drop by when you can, show us what you've got,
ask and answer questions, or just listen and lurk.

Perl and programming in general are fair game, along with Raku,

Zoom meeting link:
https://us02web.zoom.us/j/84661895479?pwd=f2QJ1XTaquo6JDbhNwuFalAqoDpHJ8.1

Passcode: 4RakuRoll

2025-02-11T01:58:37Z
The SF Perl Raku Study Group, 02/09 at 1pm PST by Joseph Brenner

From: Joseph Brenner "The term Baroque probably ultimately derived from the Italian
word barocco, which philosophers used during the Middle Ages to
describe an obstacle in schematic logic. Subsequently the word
came to denote any contorted idea or involuted process of
thought. ... In art criticism the word Baroque came to be used
to describe anything irregular, bizarre, or otherwise departing
from established rules and proportions."

Encyclopedia Britannica "Baroque art and architecture"
https://www.britannica.com/art/Baroque-art-and-architecture

The Raku Study Group

February 9, 2025 1pm in California, 9pm in the UK

An informal meeting: drop by when you can, show us what you've got,
ask and answer questions, or just listen and lurk.

Perl and programming in general are fair game, along with Raku,

Zoom meeting link:
https://us02web.zoom.us/j/82992902436?pwd=9HTor3l74UjrnEPVpzK9VnycTEGTEp.1

Passcode: 4RakuRoll

2025-02-05T20:07:07Z
The SF Perl Raku Study Group, 01/26 at 1pm PST by Joseph Brenner

From: Joseph Brenner "In my experience, the sweet spot is to implement new modules in a
_somewhat general-purpose_ fashion. The phrase 'somewhat
general-purpose' means that the module's functionality should
reflect your current needs, but its interface should not. ... The
word 'somewhat' is important: don't get carried away and build
something so general-purpose that it is difficult to use for your
current needs."

John Ousterhout, Stanford University
_A Philosophy of Software Design_ (2018)

The Raku Study Group

January 26, 2005 1pm in California, 9pm in the UK

An informal meeting: drop by when you can, show us what you've got,
ask and answer questions, or just listen and lurk.

Perl and programming in general are fair game, along with Raku,

Zoom meeting link:
https://us02web.zoom.us/j/86114142481?pwd=AQaWj8tiBdAfvN5law6FTYsD61GksT.1

Passcode: 4RakuRoll

2025-01-24T06:00:24Z
The Raku Study Group: postponed to January 26th by Joseph Brenner

From: Joseph Brenner I've had to cancel the announced meeting on the 19th. The next Raku Study
Group is on January 26th. Hope to see you.


https://github.com/doomvox/raku-study

2025-01-17T23:36:25Z
Re: I need help understanding a match by ToddAndMargo via perl6-users

From: ToddAndMargo via perl6-users On 1/16/25 1:41 AM, Todd Chester via perl6-users wrote:
> First I should apologize for one of my earlier posts. The first token
> was a bit of a jumble. I think now you just want the literal string
> "download" to start your capture.

Hi Bill,

Don't apologize. You are teaching me at trans
light speed (FLT or Faster Than Light, it is
coming to humanity soon). I sincerely appreciate
it.

I am still slowly reading over your post, bit by
bit, to make sure I completely understand it.

:-)

-T

2025-01-16T23:57:39Z
Re: I need help understanding a match by Todd Chester via perl6-users

From: Todd Chester via perl6-users Thank you!


On 1/13/25 18:20, William Michels via perl6-users wrote:
> Hi Todd,
>
> First I should apologize for one of my earlier posts. The first token was a bit of a jumble. I think now you just want the literal string "download" to start your capture.
>
> As per usual I tried a few different approaches to your regex problem, and posted what I thought was the best one, However an older iteration crept into one of my email posts: it used `^` which is Raku's zero-width "start-of-string" regex token.
>
> If you use `^` you will capture from the start-of-string onward, in this case through the `.*?` any-character token and up to the \> angle. You may not want this as it actually means the word "download" isn't required for you to capture that sequence of characters.
>
> I'm not sure where you got the impression that `\...\` actually means anything specific in Raku. If you're asking for a match against alphanumeric characters in Raku you don't have to escape them. Anything else (e.g. punctuation) you'll have to escape. So this means if you're trying to match ">" the "greater-than" sign (angle), you'll have to escape it via a backslash (e.g. `\>`), or by quoting (e.g. ">").
>
> For non-alphanumeric characters, an unescaped punctuation characters is reserved for special "metacharacter" purposes: for example an unescaped "." dot means "any-character". You'll also note backslashing used to denote characters that are difficult to represent otherwise. Think for example how `\n` means newline, `\t` means tab. There are others: `\s` means whitespace, `\h` means horizontal-whitespace, and `\v` means vertical whitespace. Also `\S` means non-whitespace, `\H` means non- horizontal-whitespace, and `\V` means non- vertical-whitespace.
>
> I've also posted direct links to Raku regex forms, such as `<?before ... >` (a positive lookahead) and `<?after ... >` (a positive lookbehind). You can try this in the REPL:
>
> [0] > my $a = "XYZ"
> XYZ
> [1] > say $a ~~ m/ <?after X > Y <?before Z > /;
> ï½¢Yï½£
>
> Try reading that out loud in English, "say $a smartmatching against a requested `m` match comprising after-X, Y, before-Z". If you read it that way, you'll understand why only the `ï½¢Yï½£` ends up in the match variable. You can also `andthen` the smartmatch, which will put the match in the `$_` topic variable for you, which can help with stringification:
>
> [1] > $a ~~ m/ <?after X > Y <?before Z > / andthen put $_.Str;
> Y
>
> I'll try to go through and correct what you wrote below. Best, Bill.
>
>> On Jan 12, 2025, at 03:11, ToddAndMargo via perl6-users <perl6-users@perl.org> wrote:
>>
>> Hi Bill,
>>
>> Please correct my notes.
>>
>> Many thanks,
>> -T
>>
>>
>>
>> Explanation:
>> my @y = $x ~~ m:g/ <?before ^ | download > .*? <?before \> | \h+ > /;
>>
>> `m:g` # match and global
> CORRECT
>> `\...\` # the constrains (beginning and end) of the match
> NO, backslashes are used to escape non-alphanumeric characters, denote invisible characters (e.g. `\n`), etc.
>> `<...>` # constraints of instructions inside the match
> NO, `<?after ... >` is a lookbehind and `<?before ... >` is a lookahead.
>>
>>
>>
>> First instruction: `<?before ^ | download >`
> NO, this should just be the literal string `download` (or `"download"`)
>>
>> `?download ^` # positive look-behind, match but don`t capture `download `
>> # `^` means "look behind"
>>
>> `|` # This is logical "OR"
>>
>> `download ` # positive look-behind, match but don`t capture `download `
>>
>> summary: capture everything behind `before ` or capture just `download`
>>
>>
>> Second instruction: `.*?`
>> `.*?` # any-character, one-or-more, frugal up to the third instruction
> YES, CORRECT
>>
>>
>> Third instruction: `<?before \> | \h+ >`
> NO, SIMPLIFY THIS TO `<?before \>` and the match will stop when it encounters ">" the "greater-than" sign (angle). Because you're using a lookahead (match characters and "lookahead" to find a pattern but don't capture, example ), the ">" angle doesn't get captured.
>>
>> `<?before \>` # positive look-ahead, match but don`t capture `download \>`
> KINDA, the actual construct is `<?before \> >` or (even more readable), `<?before ">" >`
>> # Note that the `\` in `\>` is escaping the `>` and is removing
> KINDA, the `\` backslash in front of a non-alphanumeric is a rule in Raku. If it isn't backslashed Raku will try to interpret the non-alphanumeric as a metacharacter.
>> # the `>` from the instructions constraints and making is part
>> # of the match
> The unescaped `>` is part of the lookahead/lookbehind construct, either `<?after ... >` (lookbehind) or `<?before ... >` (lookahead).
>>
>> `|` # This is logical "OR"
> YES
>>
>> `\h+ ` # one-or-more horizontal whitespace character
> YES
>>
>> summary: capture everything before `before` or one-or-more whitespace characters
> KINDA. Match the previous tokens, and stop matching when (before) you find one-or-more whitespace characters.
>>
>>
>
> HTH.

2025-01-16T09:41:35Z
Re: Q[] question by ToddAndMargo via perl6-users <p>From: ToddAndMargo via perl6-users On 1/13/25 2:25 AM, Elizabeth Mattijsen wrote:<br/>&gt;&gt; On 12 Jan 2025, at 04:46, Kevin Pye &lt;kjpraku@pye.id.au&gt; wrote:<br/>&gt;&gt;<br/>&gt;&gt; On Sun, 12 Jan 2025, at 14:01, ToddAndMargo via perl6-users wrote:<br/>&gt;&gt;&gt; Hi All,<br/>&gt;&gt;&gt;<br/>&gt;&gt;&gt; Is<br/>&gt;&gt;&gt; Q[...]<br/>&gt;&gt;&gt;<br/>&gt;&gt;&gt; the same thing as<br/>&gt;&gt;&gt; &lt;...&gt;<br/>&gt;&gt;&gt; ?<br/>&gt;&gt;<br/>&gt;&gt; No.<br/>&gt;&gt;<br/>&gt;&gt; Q[&hellip;] is the bare quoting construct. There&#39;ll be no interpolation of variables, no splitting into words, nothing other than creating a bare string.<br/>&gt;&gt;<br/>&gt;&gt; But Q also takes various adverbs to add all the nice extra available features. &lt;&hellip;&gt; is the same as Q:w:v[&hellip;]. The :w will split the input into words and return a list rather than a single string. :v will create allomorphs where possible. For example the substring &quot;12&quot; will create an allomorph which can act as either the string &quot;12&quot; or the number 12.<br/>&gt;&gt;<br/>&gt;&gt; The is all explained much better than I can in https://docs.raku.org/language/quoting<br/>&gt; <br/>&gt; And in a more whimsical approach: https://raku-advent.blog/2023/12/10/day-10-the-magic-of-q/<br/><br/><br/>Thank you!<br/><br/>I added it to my literal keeper.<br/><br/>-T<br/></p> 2025-01-14T06:00:58Z Re: I need help understanding a match by William Michels via perl6-users

From: William Michels via perl6-users Hi Todd,

First I should apologize for one of my earlier posts. The first token was a bit of a jumble. I think now you just want the literal string "download" to start your capture.

As per usual I tried a few different approaches to your regex problem, and posted what I thought was the best one, However an older iteration crept into one of my email posts: it used `^` which is Raku's zero-width "start-of-string" regex token.

If you use `^` you will capture from the start-of-string onward, in this case through the `.*?` any-character token and up to the \> angle. You may not want this as it actually means the word "download" isn't required for you to capture that sequence of characters.

I'm not sure where you got the impression that `\...\` actually means anything specific in Raku. If you're asking for a match against alphanumeric characters in Raku you don't have to escape them. Anything else (e.g. punctuation) you'll have to escape. So this means if you're trying to match ">" the "greater-than" sign (angle), you'll have to escape it via a backslash (e.g. `\>`), or by quoting (e.g. ">").

For non-alphanumeric characters, an unescaped punctuation characters is reserved for special "metacharacter" purposes: for example an unescaped "." dot means "any-character". You'll also note backslashing used to denote characters that are difficult to represent otherwise. Think for example how `\n` means newline, `\t` means tab. There are others: `\s` means whitespace, `\h` means horizontal-whitespace, and `\v` means vertical whitespace. Also `\S` means non-whitespace, `\H` means non- horizontal-whitespace, and `\V` means non- vertical-whitespace.

I've also posted direct links to Raku regex forms, such as `<?before ... >` (a positive lookahead) and `<?after ... >` (a positive lookbehind). You can try this in the REPL:

[0] > my $a = "XYZ"
XYZ
[1] > say $a ~~ m/ <?after X > Y <?before Z > /;
ï½¢Yï½£

Try reading that out loud in English, "say $a smartmatching against a requested `m` match comprising after-X, Y, before-Z". If you read it that way, you'll understand why only the `ï½¢Yï½£` ends up in the match variable. You can also `andthen` the smartmatch, which will put the match in the `$_` topic variable for you, which can help with stringification:

[1] > $a ~~ m/ <?after X > Y <?before Z > / andthen put $_.Str;
Y

I'll try to go through and correct what you wrote below. Best, Bill.

> On Jan 12, 2025, at 03:11, ToddAndMargo via perl6-users <perl6-users@perl.org> wrote:
>
> Hi Bill,
>
> Please correct my notes.
>
> Many thanks,
> -T
>
>
>
> Explanation:
> my @y = $x ~~ m:g/ <?before ^ | download > .*? <?before \> | \h+ > /;
>
> `m:g` # match and global
CORRECT
> `\...\` # the constrains (beginning and end) of the match
NO, backslashes are used to escape non-alphanumeric characters, denote invisible characters (e.g. `\n`), etc.
> `<...>` # constraints of instructions inside the match
NO, `<?after ... >` is a lookbehind and `<?before ... >` is a lookahead.
>
>
>
> First instruction: `<?before ^ | download >`
NO, this should just be the literal string `download` (or `"download"`)
>
> `?download ^` # positive look-behind, match but don`t capture `download `
> # `^` means "look behind"
>
> `|` # This is logical "OR"
>
> `download ` # positive look-behind, match but don`t capture `download `
>
> summary: capture everything behind `before ` or capture just `download`
>
>
> Second instruction: `.*?`
> `.*?` # any-character, one-or-more, frugal up to the third instruction
YES, CORRECT
>
>
> Third instruction: `<?before \> | \h+ >`
NO, SIMPLIFY THIS TO `<?before \>` and the match will stop when it encounters ">" the "greater-than" sign (angle). Because you're using a lookahead (match characters and "lookahead" to find a pattern but don't capture, example ), the ">" angle doesn't get captured.
>
> `<?before \>` # positive look-ahead, match but don`t capture `download \>`
KINDA, the actual construct is `<?before \> >` or (even more readable), `<?before ">" >`
> # Note that the `\` in `\>` is escaping the `>` and is removing
KINDA, the `\` backslash in front of a non-alphanumeric is a rule in Raku. If it isn't backslashed Raku will try to interpret the non-alphanumeric as a metacharacter.
> # the `>` from the instructions constraints and making is part
> # of the match
The unescaped `>` is part of the lookahead/lookbehind construct, either `<?after ... >` (lookbehind) or `<?before ... >` (lookahead).
>
> `|` # This is logical "OR"
YES
>
> `\h+ ` # one-or-more horizontal whitespace character
YES
>
> summary: capture everything before `before` or one-or-more whitespace characters
KINDA. Match the previous tokens, and stop matching when (before) you find one-or-more whitespace characters.
>
>

HTH.

2025-01-14T02:20:30Z
Re: Q[] question by Elizabeth Mattijsen <p>From: Elizabeth Mattijsen &gt; On 12 Jan 2025, at 04:46, Kevin Pye &lt;kjpraku@pye.id.au&gt; wrote: <br/>&gt; <br/>&gt; On Sun, 12 Jan 2025, at 14:01, ToddAndMargo via perl6-users wrote: <br/>&gt;&gt; Hi All, <br/>&gt;&gt; <br/>&gt;&gt; Is <br/>&gt;&gt; Q[...] <br/>&gt;&gt; <br/>&gt;&gt; the same thing as <br/>&gt;&gt; &lt;...&gt; <br/>&gt;&gt; ? <br/>&gt; <br/>&gt; No. <br/>&gt; <br/>&gt; Q[&hellip;] is the bare quoting construct. There&#39;ll be no interpolation of variables, no splitting into words, nothing other than creating a bare string. <br/>&gt; <br/>&gt; But Q also takes various adverbs to add all the nice extra available features. &lt;&hellip;&gt; is the same as Q:w:v[&hellip;]. The :w will split the input into words and return a list rather than a single string. :v will create allomorphs where possible. For example the substring &quot;12&quot; will create an allomorph which can act as either the string &quot;12&quot; or the number 12. <br/>&gt; <br/>&gt; The is all explained much better than I can in https://docs.raku.org/language/quoting <br/> <br/>And in a more whimsical approach: https://raku-advent.blog/2023/12/10/day-10-the-magic-of-q/</p> 2025-01-13T10:25:21Z Re: I need help understanding a match by ToddAndMargo via perl6-users <p>From: ToddAndMargo via perl6-users On 1/12/25 3:11 AM, ToddAndMargo via perl6-users wrote:<br/>&gt; `?download ^`&nbsp;&nbsp; # positive look-behind, match but don`t capture `download `<br/>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # `^` means &quot;look behind&quot;<br/><br/>Opps, that should be:<br/><br/>`?before ^` # positive look-behind, match but don`t capture `download `<br/> # `^` means &quot;look behind&quot;<br/><br/></p> 2025-01-12T11:18:23Z