perl.perl6.users https://www.nntp.perl.org/group/perl.perl6.users/ ... Copyright 1998-2025 perl.org Fri, 09 May 2025 06:26:35 +0000 ask@perl.org The SF Perl Raku Study Group, 04/27 at 1pm PST (ALREADY IN PROGRESS) by Joseph Brenner via perl6-users We&#39;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<br/><br/>Zoom meeting link:<br/>https://us02web.zoom.us/j/85308554316?pwd=52Bc9BpWgd7Xsi6tqQT2QhSQ8eWDkM.1<br/><br/>Passcode: 4RakuRoll https://www.nntp.perl.org/group/perl.perl6.users/2025/04/msg11413.html Sun, 27 Apr 2025 20:16:42 +0000 Re: How do I print a structure? by 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/> https://www.nntp.perl.org/group/perl.perl6.users/2025/04/msg11412.html Sat, 12 Apr 2025 18:56:16 +0000 Re: H9w do I print a structure? by 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/> https://www.nntp.perl.org/group/perl.perl6.users/2025/04/msg11411.html Sat, 12 Apr 2025 17:17:05 +0000 Re: rename and unc by 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/> https://www.nntp.perl.org/group/perl.perl6.users/2025/04/msg11410.html Fri, 11 Apr 2025 08:47:37 +0000 Re: rename and unc by William Michels via perl6-users From Raku&#39;s `rename` man-page: <br/> <br/>&quot;Note: some renames will always fail, such as when the new name is on a different storage device. See also: move.&quot; <br/> <br/>https://docs.raku.org/routine/rename <br/> <br/>HTH, Bill. <br/> <br/>PS. If you want Raku code fitting a &#39;create-backup; unlink-original; copy-backup-to-original-location&#39; strategy, look here: <br/> <br/>https://unix.stackexchange.com/questions/749558/remove-exact-line-from-file-if-present-leave-the-rest-of-lines-error-handling/749581#749581 <br/> <br/> <br/>&gt; On Apr 3, 2025, at 19:05, ToddAndMargo via perl6-users &lt;perl6-users@perl.org&gt; wrote: <br/>&gt; <br/>&gt; &gt; On Thu, Apr 3, 2025 at 2:14&#x202F;AM 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; And another IO ffunctio that does ot work: <br/>&gt; &gt; <br/>&gt; &gt; RotateArchives: renaming directory <br/>&gt; &gt; \\192.168.240.10\oldserver\Backup\MyDocsBackup\backup6 to <br/>&gt; &gt; \\192.168.240.10\oldserver\Backup\MyDocsBackup\backup4 <br/>&gt; &gt; <br/>&gt; &gt; Failed to rename <br/>&gt; &gt; &#39;C:\192.168.240.10\oldserver\Backup\MyDocsBackup\backup6&#39; to <br/>&gt; &gt; &#39;C:\192.168.240.10\oldserver\Backup\MyDocsBackup\backup4&#39;: Failed to <br/>&gt; &gt; rename file: no such file or directory <br/>&gt; &gt; <br/>&gt; &gt; rename put a freaking C: on teh unc path. <br/>&gt; &gt; <br/>&gt; &gt; Another call to powershell. Poop! <br/>&gt; &gt; <br/>&gt; &gt; <br/>&gt; On 4/3/25 12:08 PM, yary wrote: <br/>&gt;&gt; The first 3 characters of the error is telling you the problem <br/>&gt;&gt; C:\192 <br/>&gt;&gt; it&#39;s same as in another thread, use Q[\\192 ... instead of &#39;\\192 ... , so that you preserve the backslashes. <br/>&gt; <br/>&gt; That other thread had that path in a variable. Raku messed <br/>&gt; with the variable when I made the IO call. And I <br/>&gt; can not put a variable into a Q[]. AAAAAA HHHH !!!! <br/>&gt; <br/>&gt;&gt; OR <br/>&gt;&gt; double each backslash- `\\\\192.168.240.10\\oldserver ... and then you can keep using variables as you normally do. <br/>&gt;&gt; -y <br/>&gt; <br/>&gt; Hi Yary, <br/>&gt; <br/>&gt; This is a glaring bug. <br/>&gt; <br/>&gt; The call was <br/>&gt; rename $Oldpath $NewPath <br/>&gt; <br/>&gt; $OldPath was `\\192.168.240.10\oldserver\Backup\MyDocsBackup\backup6` <br/>&gt; $NewPath was `\\192.168.240.10\oldserver\Backup\MyDocsBackup\backup4` <br/>&gt; <br/>&gt; Once I have something added to a variable, it is HANDS OFF. DO <br/>&gt; NOT MESS WITH IT. Before then, it is appreciated. BUT NOT AFTER! <br/>&gt; <br/>&gt; Not only did rename mess with my variables, but it added `C:` to it. <br/>&gt; <br/>&gt; If the powers-that-be ever decide to fix IO under Windows, any workaround I do to get around the current situation will <br/>&gt; be broken. And back to chasing ghosts again. <br/>&gt; <br/>&gt; My solution is to add powershell calls to my NativeWinUtils.rakumod <br/>&gt; and use them instead of raku&#39;s IO calls. <br/>&gt; <br/>&gt; An example: <br/>&gt; <br/>&gt; sub DirectoryExists( Str $DirPath --&gt; Bool ) { <br/>&gt; # $Full DirPath format is \\192.168.240.10\oldserver\Backup\MyDocsBackup\backup <br/>&gt; my $SubName = &amp;?ROUTINE.name; <br/>&gt; my Str $RtnStr = RunCmd &quot;powershell Test-Path $DirPath&quot;, True; <br/>&gt; $RtnStr = $RtnStr.chomp; <br/>&gt; if $CommandLine.debug { print &quot;$SubName: powershell Test-Path returned &lt;$RtnStr&gt; for &lt;$DirPath&gt;\n\n&quot;; } <br/>&gt; if $RtnStr.lc.contains( &quot;true&quot; ) { return True; } else { return False; } <br/>&gt; } <br/>&gt; <br/>&gt; Oh ya, and the above actually works! <br/>&gt; <br/>&gt; Forgive my being crabby. I have been coding on this project <br/>&gt; for over a week. It was only suppose to take a day. I have <br/>&gt; been CHASING GHOSTS. I am really, really tired. Now I have <br/>&gt; to remove all of the IO calls from my code and replace them <br/>&gt; with calls to powershell. AAAA HHHH !!!!!! At least I <br/>&gt; have finally figured out what was going wrong. <br/>&gt; <br/>&gt; Thank you for the help! <br/>&gt; <br/>&gt; -T <br/>&gt; <br/>&gt; <br/>&gt; <br/>&gt; <br/>&gt; <br/>&gt; <br/> <br/> https://www.nntp.perl.org/group/perl.perl6.users/2025/04/msg11409.html Fri, 11 Apr 2025 07:53:51 +0000 The SF Perl Raku Study Group, 04/13 at 1pm PST by Joseph Brenner And riding fast on the heels of the last one, comes The Raku Study Group:<br/><br/> &quot;There is no idea so frivolous or odd which does not appear<br/> to me to be fittingly produced by the mind of man. Those<br/> of us who deprive our judgment of the right to pass<br/> sentence look gently on strange opinions; we may not lend<br/> them our approbation but we do readily lend them our ears.&quot;<br/><br/> Michel de Montaigne, &quot;The Art of Conference&quot; (1588)<br/> Translation: M.A. Screech<br/><br/>April 13, 2025 1pm in California, 8pm in the UK<br/><br/>An informal meeting: drop by when you can, show us what you&#39;ve got,<br/>ask and answer questions, or just listen and lurk.<br/><br/>Perl and programming in general are fair game, along with Raku,<br/><br/>Zoom meeting link:<br/> https://us02web.zoom.us/j/89366078473?pwd=Iu8rQKIeZ3vRlhDZbaalmXAW8EJRkq.1<br/><br/>Passcode: 4RakuRoll<br/> https://www.nntp.perl.org/group/perl.perl6.users/2025/04/msg11408.html Fri, 11 Apr 2025 06:42:22 +0000 H9w do I print a structure? by ToddAndMargo via perl6-users Hi All,<br/><br/>I am not having any luck printing the values of a OOP<br/>structure, except for printing them one at a time. I<br/>can get it to messily print with `say`, but I want to<br/>do it with `print` so I can control the line feeds,<br/>comments, etc..<br/><br/>What am I doing wrong?<br/><br/>Many thanks,<br/>-T<br/><br/><br/>[0] &gt; class PartitionClass{<br/> has Str $.DeviceID is rw;<br/> has Str $.VolumeName is rw;<br/> has Str $.ProviderName is rw;<br/> has Str $.UNC_BackupPath is rw;<br/> has Int $.DriveType is rw;<br/> has Str $.DriveTypeStr is rw;<br/> has Int $.FreeSpace is rw;<br/> has Int $.Size is rw;<br/> has Int $.PercentUsed is rw;<br/> has Int $.PercentRemaining is rw;<br/>}<br/>(PartitionClass)<br/><br/><br/>[1] &gt; my $Partition = PartitionClass.new(<br/> DeviceID =&gt; &quot;&quot;,<br/> VolumeName =&gt; &quot;&quot;,<br/> ProviderName =&gt; &quot;&quot;,<br/> UNC_BackupPath =&gt; &quot;&quot;,<br/> DriveType =&gt; 0,<br/> DriveTypeStr =&gt; &quot;Unknown&quot;,<br/> FreeSpace =&gt; 0,<br/> Size =&gt; 0,<br/> PercentUsed =&gt; 0,<br/> PercentRemaining =&gt; 100<br/>);<br/>PartitionClass.new(DeviceID =&gt; &quot;&quot;, VolumeName =&gt; &quot;&quot;, ProviderName =&gt; &quot;&quot;, <br/>UNC_BackupPath =&gt; &quot;&quot;, DriveType =&gt; 0, DriveTypeStr =&gt; &quot;Unknown&quot;, <br/>FreeSpace =&gt; 0, Size =&gt; 0, PercentUsed =&gt; 0, PercentRemaining =&gt; 100)<br/><br/><br/>[2] &gt; for $Partition.kv -&gt; $i, $j { print &quot;i &lt;$i&gt; j &lt;$j&gt;\n&quot; }<br/>i &lt;0&gt; j &lt;PartitionClass&lt;4875316684000&gt;&gt;<br/><br/><br/>[2] &gt; print $Partition ~ &quot;\n&quot;;<br/>PartitionClass&lt;4875316684000&gt;<br/><br/><br/>[2] &gt; say $Partition;<br/>PartitionClass.new(DeviceID =&gt; &quot;&quot;, VolumeName =&gt; &quot;&quot;, ProviderName =&gt; &quot;&quot;, <br/>UNC_BackupPath =&gt; &quot;&quot;, DriveType =&gt; 0, DriveTypeStr =&gt; &quot;Unknown&quot;, <br/>FreeSpace =&gt; 0, Size =&gt; 0, PercentUsed =&gt; 0, PercentRemaining =&gt; 100)<br/><br/><br/><br/> https://www.nntp.perl.org/group/perl.perl6.users/2025/04/msg11407.html Fri, 11 Apr 2025 06:20:09 +0000 Re: I need help with .IO.d.Bool by ToddAndMargo via perl6-users On 4/5/25 6:58 PM, ToddAndMargo via perl6-users wrote:<br/>&gt; sub Directory<br/><br/>I changed the name to DirectoryExists<br/><br/>The new name is more human friendly<br/> https://www.nntp.perl.org/group/perl.perl6.users/2025/04/msg11406.html Sun, 06 Apr 2025 09:47:57 +0000 Re: I need help with .IO.d.Bool by ToddAndMargo via perl6-users On 4/2/25 6:08 PM, Bruce Gray wrote:<br/>&gt; <br/>&gt; <br/>&gt;&gt; On Apr 2, 2025, at 19:47, ToddAndMargo via perl6-users &lt;perl6-users@perl.org&gt; wrote:<br/>&gt; <br/>&gt; --snip--<br/>&gt; <br/>&gt;&gt; raku -e &quot;say &#39;\\192.168.240.10\oldserver\Backup\MyDocsBackup\backup1&#39;.IO.d.Bool;&quot;<br/>&gt;&gt; False<br/>&gt; <br/>&gt; --snip--<br/>&gt; <br/>&gt; 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:<br/>&gt; say &#39;\\192.168.240.10\oldserver\Backup\MyDocsBackup\backup1&#39;;<br/>&gt; The output is:<br/>&gt; \192.168.240.10\oldserver\Backup\MyDocsBackup\backup1<br/>&gt; So, the initial two backslashes are becoming a single backslash.<br/>&gt; 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.<br/>&gt; <br/>&gt; Does changing your one-liner to this:<br/>&gt; raku -e &quot;say Q[\\192.168.240.10\oldserver\Backup\MyDocsBackup\backup1].IO.d.Bool;&quot;<br/>&gt; fix the problem?<br/>&gt; 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).<br/>&gt; <br/><br/><br/>Hi Bruce,<br/><br/>I need the function to operate with the exact path<br/>assigned by Windows. No adding or subtracting.<br/><br/>This was my work around:<br/><br/><br/>sub Directory( Str $DriveDirectory ) returns Bool is export( :Directory ) {<br/> # True if a Directory or Drive Letter<br/><br/> my Str $RtnStr = RunCmd( &quot;powershell.exe test-path -Path &quot; ~ Q[&quot;] <br/>~ $DriveDirectory ~ Q[&quot;] ~ &quot; -PathType Container&quot;, True );<br/> # print &quot;RtnStr = &lt;$RtnStr&gt;\n&quot;;<br/> if $RtnStr.lc.starts-with( &quot;true&quot; ) { return True; } else { return <br/>False; }<br/>}<br/><br/><br/>Notice that I did not have to mess the `$DriveDirectory`?<br/><br/>.IO.d.Bool needs to do the same.<br/><br/>Let me know if you want the code for `RunCmd`.<br/><br/>Thank you for the help,<br/>-T<br/><br/><br/> https://www.nntp.perl.org/group/perl.perl6.users/2025/04/msg11405.html Sun, 06 Apr 2025 01:59:10 +0000 Re: I need help with .IO.d.Bool by Bruce Gray <br/> <br/>&gt; On Apr 2, 2025, at 19:47, ToddAndMargo via perl6-users &lt;perl6-users@perl.org&gt; wrote: <br/> <br/>--snip-- <br/> <br/>&gt; raku -e &quot;say &#39;\\192.168.240.10\oldserver\Backup\MyDocsBackup\backup1&#39;.IO.d.Bool;&quot; <br/>&gt; False <br/> <br/>--snip-- <br/> <br/>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: <br/> say &#39;\\192.168.240.10\oldserver\Backup\MyDocsBackup\backup1&#39;; <br/>The output is: <br/> \192.168.240.10\oldserver\Backup\MyDocsBackup\backup1 <br/>So, the initial two backslashes are becoming a single backslash. <br/>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. <br/> <br/>Does changing your one-liner to this: <br/> raku -e &quot;say Q[\\192.168.240.10\oldserver\Backup\MyDocsBackup\backup1].IO.d.Bool;&quot; <br/>fix the problem? <br/>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). <br/> <br/>-- <br/>Hope this helps, <br/>Bruce Gray (Util of PerlMonks) <br/> <br/> https://www.nntp.perl.org/group/perl.perl6.users/2025/04/msg11404.html Sun, 06 Apr 2025 00:14:32 +0000 Re: rename and unc by ToddAndMargo via perl6-users &gt; On Thu, Apr 3, 2025 at 2:14&#x202F;AM ToddAndMargo via perl6-users &lt;perl6-<br/> &gt; users@perl.org &lt;mailto:perl6-users@perl.org&gt;&gt; wrote:<br/> &gt;<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/>On 4/3/25 12:08 PM, yary wrote:<br/>&gt; The first 3 characters of the error is telling you the problem<br/>&gt; <br/>&gt; C:\192<br/>&gt; <br/>&gt; it&#39;s same as in another thread, use Q[\\192 ... instead of &#39;\\192 ... , <br/>&gt; so that you preserve the backslashes.<br/><br/>That other thread had that path in a variable. Raku messed<br/>with the variable when I made the IO call. And I<br/>can not put a variable into a Q[]. AAAAAA HHHH !!!!<br/><br/>&gt; OR<br/>&gt; <br/>&gt; double each backslash- `\\\\192.168.240.10\\oldserver ... and then you <br/>&gt; can keep using variables as you normally do.<br/>&gt; <br/>&gt; -y<br/><br/>Hi Yary,<br/><br/>This is a glaring bug.<br/><br/>The call was<br/> rename $Oldpath $NewPath<br/><br/>$OldPath was `\\192.168.240.10\oldserver\Backup\MyDocsBackup\backup6`<br/>$NewPath was `\\192.168.240.10\oldserver\Backup\MyDocsBackup\backup4`<br/><br/>Once I have something added to a variable, it is HANDS OFF. DO<br/>NOT MESS WITH IT. Before then, it is appreciated. BUT NOT AFTER!<br/><br/>Not only did rename mess with my variables, but it added `C:` to it.<br/><br/>If the powers-that-be ever decide to fix IO under Windows, any <br/>workaround I do to get around the current situation will<br/>be broken. And back to chasing ghosts again.<br/><br/>My solution is to add powershell calls to my NativeWinUtils.rakumod<br/>and use them instead of raku&#39;s IO calls.<br/><br/>An example:<br/><br/>sub DirectoryExists( Str $DirPath --&gt; Bool ) {<br/> # $Full DirPath format is <br/>\\192.168.240.10\oldserver\Backup\MyDocsBackup\backup<br/> my $SubName = &amp;?ROUTINE.name;<br/> my Str $RtnStr = RunCmd &quot;powershell Test-Path $DirPath&quot;, True;<br/> $RtnStr = $RtnStr.chomp;<br/> if $CommandLine.debug { print &quot;$SubName: powershell Test-Path <br/>returned &lt;$RtnStr&gt; for &lt;$DirPath&gt;\n\n&quot;; }<br/> if $RtnStr.lc.contains( &quot;true&quot; ) { return True; } else { return <br/>False; }<br/>}<br/><br/>Oh ya, and the above actually works!<br/><br/>Forgive my being crabby. I have been coding on this project<br/>for over a week. It was only suppose to take a day. I have<br/>been CHASING GHOSTS. I am really, really tired. Now I have<br/>to remove all of the IO calls from my code and replace them<br/>with calls to powershell. AAAA HHHH !!!!!! At least I<br/>have finally figured out what was going wrong.<br/><br/>Thank you for the help!<br/><br/>-T<br/><br/><br/><br/><br/><br/><br/> https://www.nntp.perl.org/group/perl.perl6.users/2025/04/msg11403.html Fri, 04 Apr 2025 02:06:04 +0000 Re: unc "for" bug by 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/> https://www.nntp.perl.org/group/perl.perl6.users/2025/04/msg11402.html Fri, 04 Apr 2025 01:11:36 +0000 Re: rename and unc by 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/> https://www.nntp.perl.org/group/perl.perl6.users/2025/04/msg11401.html Thu, 03 Apr 2025 19:08:21 +0000 Re: unc "for" bug by 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/> https://www.nntp.perl.org/group/perl.perl6.users/2025/04/msg11400.html Thu, 03 Apr 2025 19:03:10 +0000 The SF Perl Raku Study Group, 04/06 at 1pm PST by Joseph Brenner The Raku Study Group<br/><br/>&quot;This time for sure!&quot; -- Bullwinkle J. Moose<br/><br/>April 6th, 2025 1pm in California, 8pm in the UK<br/><br/>An informal meeting: drop by when you can, show us what you&#39;ve got,<br/>ask and answer questions, or just listen and lurk.<br/><br/>Perl and programming in general are fair game, along with Raku,<br/><br/>Zoom meeting link:<br/> https://us02web.zoom.us/j/89759925908?pwd=59mwQboALSjiFQB9tdT2DDd4Xkxdi8.1<br/><br/>Passcode: 4RakuRoll<br/> https://www.nntp.perl.org/group/perl.perl6.users/2025/04/msg11399.html Thu, 03 Apr 2025 08:29:58 +0000 rename and unc by ToddAndMargo via perl6-users And another IO ffunctio that does ot work:<br/><br/>RotateArchives: renaming directory <br/>\\192.168.240.10\oldserver\Backup\MyDocsBackup\backup6 to <br/>\\192.168.240.10\oldserver\Backup\MyDocsBackup\backup4<br/><br/>Failed to rename <br/>&#39;C:\192.168.240.10\oldserver\Backup\MyDocsBackup\backup6&#39; to <br/>&#39;C:\192.168.240.10\oldserver\Backup\MyDocsBackup\backup4&#39;: Failed to <br/>rename file: no such file or directory<br/><br/>rename put a freaking C: on teh unc path.<br/><br/>Another call to powershell. Poop!<br/><br/><br/> https://www.nntp.perl.org/group/perl.perl6.users/2025/04/msg11398.html Thu, 03 Apr 2025 06:14:20 +0000 Re: I need help with .IO.d.Bool by ToddAndMargo via perl6-users On 4/2/25 9:53 PM, ToddAndMargo via perl6-users wrote:<br/>&gt; On 4/2/25 6:26 PM, Will Coleda wrote:<br/>&gt;&gt; Try printing the Str before you do anything with it to see what happens.<br/>&gt; <br/>&gt; <br/>&gt; I moved to powershell<br/><br/>I mean I did a call to powershell to find if a directory existed<br/> https://www.nntp.perl.org/group/perl.perl6.users/2025/04/msg11397.html Thu, 03 Apr 2025 05:24:44 +0000 Re: I need help with .IO.d.Bool by ToddAndMargo via perl6-users On 4/2/25 6:26 PM, Will Coleda wrote:<br/>&gt; Try printing the Str before you do anything with it to see what happens.<br/><br/><br/>I moved to powershell<br/> https://www.nntp.perl.org/group/perl.perl6.users/2025/04/msg11396.html Thu, 03 Apr 2025 04:54:05 +0000 Re: I need help with .IO.d.Bool by ToddAndMargo via perl6-users On 4/2/25 6:08 PM, Bruce Gray wrote:<br/>&gt; <br/>&gt; <br/>&gt;&gt; On Apr 2, 2025, at 19:47, ToddAndMargo via perl6-users &lt;perl6-users@perl.org&gt; wrote:<br/>&gt; <br/>&gt; --snip--<br/>&gt; <br/>&gt;&gt; raku -e &quot;say &#39;\\192.168.240.10\oldserver\Backup\MyDocsBackup\backup1&#39;.IO.d.Bool;&quot;<br/>&gt;&gt; False<br/>&gt; <br/>&gt; --snip--<br/>&gt; <br/>&gt; 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:<br/>&gt; say &#39;\\192.168.240.10\oldserver\Backup\MyDocsBackup\backup1&#39;;<br/>&gt; The output is:<br/>&gt; \192.168.240.10\oldserver\Backup\MyDocsBackup\backup1<br/>&gt; So, the initial two backslashes are becoming a single backslash.<br/>&gt; 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.<br/>&gt; <br/>&gt; Does changing your one-liner to this:<br/>&gt; raku -e &quot;say Q[\\192.168.240.10\oldserver\Backup\MyDocsBackup\backup1].IO.d.Bool;&quot;<br/> &gt; fix the problem?<br/><br/>Yes.<br/><br/>raku -e &quot;say <br/>Q[\\192.168.240.10\oldserver\Backup\MyDocsBackup\backup1].IO.d.Bool;&quot;<br/>True<br/><br/>raku -e &quot;say <br/>Q[\\192.168.240.10\oldserver\Backup\MyDocsBackup\backup10].IO.d.Bool;&quot;<br/>False<br/><br/>Now how do I encode a variable inside a Q[]?<br/><br/><br/><br/>&gt; 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).<br/>&gt; <br/><br/> https://www.nntp.perl.org/group/perl.perl6.users/2025/04/msg11395.html Thu, 03 Apr 2025 03:39:59 +0000 unc "for" bug by 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/> https://www.nntp.perl.org/group/perl.perl6.users/2025/04/msg11394.html Thu, 03 Apr 2025 03:37:21 +0000 Re: I need help with .IO.d.Bool by 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/> https://www.nntp.perl.org/group/perl.perl6.users/2025/04/msg11393.html Thu, 03 Apr 2025 01:27:07 +0000 I need help with .IO.d.Bool by 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/> https://www.nntp.perl.org/group/perl.perl6.users/2025/04/msg11392.html Thu, 03 Apr 2025 00:47:30 +0000 Re: I need help with get-options by 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/> https://www.nntp.perl.org/group/perl.perl6.users/2025/04/msg11391.html Wed, 02 Apr 2025 21:13:03 +0000 Re: I need help with get-options by Bruce Gray <br/> <br/>&gt; On Apr 2, 2025, at 05:47, ToddAndMargo via perl6-users &lt;perl6-users@perl.org&gt; wrote: <br/> <br/>--snip-- <br/> <br/>&gt; Hi Bruce, <br/>&gt; <br/>&gt; Sorry. I do know I am suppose to post some minimal code. <br/>&gt; I was programming for 11 straight hours and was not <br/>&gt; thinking too clearly. <br/> <br/>I understand. <br/> <br/>&gt; I was trying to do what you said. Read it into a hash, then <br/>&gt; extract the values into an OOP structure. (I use to like <br/>&gt; hashes, but dropped them hard when I figured out OOP <br/>&gt; structures. I absolutely A-D-O-R-E OOP structures.) <br/>&gt; <br/>&gt; Thank you again for the help! <br/>&gt; -T <br/> <br/>--snip-- <br/> <br/> <br/>&gt; my $CommandLine = CommandLineClass.new{ <br/>&gt; help =&gt; False, <br/>&gt; debug =&gt; False, <br/>&gt; UNC_BackupPath =&gt; Q[\\192.168.240.10\MyDocsBackup\backup1], <br/>&gt; rotates =&gt; 2, <br/>&gt; ParentDir =&gt; &quot;/&quot; <br/>&gt; }; <br/> <br/>The problem is with the syntax of the `new`. <br/>You need parenthesis instead of curly braces. <br/>With that change, your code works as expected. <br/> <br/>For even DRYer code, you can flatten `%opts` directly into the `new` constructor, like so: <br/> # use lib &#39;C:/NtUtil&#39;, &#39;C:/NtUtil/p6lib&#39;; # use this one on customer machines <br/> use Getopt::Long; <br/> class CommandLineClass is rw { <br/> has Bool $.help = False; <br/> has Bool $.debug = False; <br/> has Str $.UNC_BackupPath = Q[\\192.168.240.10\MyDocsBackup\backup1]; <br/> has Int $.rotates = 2; <br/> has $.ParentDir = &#39;/&#39;; <br/> } <br/> my %opts = get-options( &#39;help&#39;, &#39;debug&#39;, &#39;UNC_BackupPath=s&#39;, &#39;rotates=i&#39;, &#39;ParentDir=s&#39; ).hash; <br/> my CommandLineClass $CommandLine .= new( |%opts ); <br/> say $CommandLine.raku if $CommandLine.debug; <br/> <br/>-- <br/>Hope this helps, <br/>Bruce Gray (Util of PerlMonks) <br/> <br/> https://www.nntp.perl.org/group/perl.perl6.users/2025/04/msg11390.html Wed, 02 Apr 2025 15:22:54 +0000 Re: I need help with get-options by 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/> https://www.nntp.perl.org/group/perl.perl6.users/2025/04/msg11389.html Wed, 02 Apr 2025 10:47:21 +0000 Re: I need help with get-options by Bruce Gray <br/> <br/>&gt; On Apr 1, 2025, at 03:55, ToddAndMargo via perl6-users &lt;perl6-users@perl.org&gt; wrote: <br/> <br/>--snip-- <br/> <br/>&gt; I have the following run string: <br/>&gt; raku C:\NtUtil\RLA.Backup.raku --rotates 345 --UNC_BackupPath \\192.168.240.10\Backup\MyDocsBackup\backup1 --debug <br/>&gt; <br/>&gt; <br/>&gt; use Getopt::Long; # get-options <br/>&gt; get-options(&#39;debug&#39; =&gt; $CommandLine.debug ); <br/>&gt; <br/>&gt; error out with <br/>&gt; No such method &#39;debug&#39; for invocant of type &#39;List&#39; <br/>&gt; <br/>&gt; What am I doing wrong? <br/> <br/>You are not giving us a https://en.wikipedia.org/wiki/Minimal_reproducible_example , so I am having to guess. <br/>My guess is that you have defined `$CommandLine` in a way that lacks a writeable `.debug` method. <br/> <br/>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/> <br/>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/> <br/> class CommandLineInfo { <br/> has Bool $.debug is rw = False; <br/> } <br/> <br/> my CommandLineInfo $CommandLine .= new; <br/> <br/> use Getopt::Long; <br/> get-options( &#39;debug&#39; =&gt; $CommandLine.debug ); <br/> <br/> say $CommandLine.debug; # Will be `True` or `False`, depending on command-line arg. <br/> <br/>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/>As always, minimal *runnable* code will allow any of us to provide an answer to you more quickly. <br/> <br/>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/> use Getopt::Long; <br/> my %CommandLine = get-options( &#39;debug&#39;, &#39;rotates=i&#39;, &#39;UNC_BackupPath=p&#39; ).hash; <br/> say ?%CommandLine&lt;debug&gt;; # Just the `debug` argument, forced to Bool <br/> say %CommandLine.raku; # All the specified arguments. <br/> <br/> <br/>&gt; Many thanks, <br/>&gt; -T <br/> <br/>You are very welcome! <br/>-- <br/>Bruce Gray (Util of PerlMonks) <br/> <br/> <br/> https://www.nntp.perl.org/group/perl.perl6.users/2025/04/msg11388.html Tue, 01 Apr 2025 23:04:43 +0000 Re: I need help with get-options by ToddAndMargo via perl6-users Should have said &quot;I need help with get-options&quot;<br/><br/><br/> https://www.nntp.perl.org/group/perl.perl6.users/2025/04/msg11387.html Tue, 01 Apr 2025 09:02:57 +0000 I need help with by 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/> https://www.nntp.perl.org/group/perl.perl6.users/2025/04/msg11386.html Tue, 01 Apr 2025 08:56:01 +0000 The SF Perl Raku Study Group, 03/23 at 1pm PST by Joseph Brenner Doug Hoyte, &quot;Let Over Lambda-- 50 Years of Lisp&quot; (2008):<br/><br/> &quot;It must also be pointed out that aif and alambda, like all anaphoric<br/> macros, violate lexical transparency. A fashionable way of saying this<br/> is currently to say that they are unhygienic macros. That is, like a<br/> good number of macros in this book, they invisibly introduce lexical<br/> bindings and thus cannot be created with macro systems that strictly<br/> enforce hygiene. Even the vast majority of Scheme systems, the<br/> platform that has experimented the most with hygiene, provide<br/> unhygienic defmacro-style macros-presumably because not even Scheme<br/> implementors take hygiene very seriously. Like training wheels on a<br/> bicycle, hygiene systems are for the most part toys that should be<br/> discarded after even a modest level of skill has been acquired.&quot;<br/><br/> https://letoverlambda.com/index.cl/guest/chap6.html<br/><br/>The Raku Study Group<br/><br/>March 23, 2025 1pm in California, 8pm in the UK<br/><br/>An informal meeting: drop by when you can, show us what you&#39;ve got,<br/>ask and answer questions, or just listen and lurk.<br/><br/>Perl and programming in general are fair game, along with Raku,<br/><br/>Zoom meeting link:<br/> https://us02web.zoom.us/j/81750169963?pwd=SY3gIr63jZtsXVgW4PDXwbOdLavt1c.1<br/><br/>Passcode: 4RakuRoll<br/> https://www.nntp.perl.org/group/perl.perl6.users/2025/03/msg11385.html Mon, 10 Mar 2025 01:30:40 +0000 The SF Perl Raku Study Group, 03/09 at 1pm PST by Joseph Brenner &quot;There is no royal road to logic, and really valuable ideas can<br/> only be had at the price of close attention. But I know that in<br/> the matter of ideas the public prefer the cheap and nasty ... &quot;<br/><br/> -- C.S. Pierce, &quot;How to Make Our Ideas Clear&quot; (1878)<br/><br/>The Raku Study Group<br/><br/>March 9, 2025 1pm in California, 9pm in the UK<br/><br/>An informal meeting: drop by when you can, show us what you&#39;ve got,<br/>ask and answer questions, or just listen and lurk.<br/><br/>Perl and programming in general are fair game, along with Raku,<br/><br/>Zoom meeting link:<br/> https://us02web.zoom.us/j/85701010841?pwd=b6eclkW4hs35tWs8a4F7kJonKaxybe.1<br/><br/>Passcode: 4RakuRoll<br/> https://www.nntp.perl.org/group/perl.perl6.users/2025/02/msg11384.html Mon, 24 Feb 2025 18:34:20 +0000 The SF Perl Raku Study Group, 02/23 at 1pm PST by Joseph Brenner &quot;I found my way in the dark by bouncing off of sharp objects,<br/>as do we all.&quot; -- Algis Budrys<br/><br/>The Raku Study Group<br/><br/>February 23, 2025 1pm in California, 9pm in the UK<br/><br/>An informal meeting: drop by when you can, show us what you&#39;ve got,<br/>ask and answer questions, or just listen and lurk.<br/><br/>Perl and programming in general are fair game, along with Raku,<br/><br/>Zoom meeting link:<br/> https://us02web.zoom.us/j/84661895479?pwd=f2QJ1XTaquo6JDbhNwuFalAqoDpHJ8.1<br/><br/>Passcode: 4RakuRoll<br/> https://www.nntp.perl.org/group/perl.perl6.users/2025/02/msg11383.html Tue, 11 Feb 2025 01:58:37 +0000 The SF Perl Raku Study Group, 02/09 at 1pm PST by Joseph Brenner &quot;The term Baroque probably ultimately derived from the Italian<br/>word barocco, which philosophers used during the Middle Ages to<br/>describe an obstacle in schematic logic. Subsequently the word<br/>came to denote any contorted idea or involuted process of<br/>thought. ... In art criticism the word Baroque came to be used<br/>to describe anything irregular, bizarre, or otherwise departing<br/>from established rules and proportions.&quot;<br/><br/> Encyclopedia Britannica &quot;Baroque art and architecture&quot;<br/> https://www.britannica.com/art/Baroque-art-and-architecture<br/><br/>The Raku Study Group<br/><br/>February 9, 2025 1pm in California, 9pm in the UK<br/><br/>An informal meeting: drop by when you can, show us what you&#39;ve got,<br/>ask and answer questions, or just listen and lurk.<br/><br/>Perl and programming in general are fair game, along with Raku,<br/><br/>Zoom meeting link:<br/> https://us02web.zoom.us/j/82992902436?pwd=9HTor3l74UjrnEPVpzK9VnycTEGTEp.1<br/><br/>Passcode: 4RakuRoll<br/> https://www.nntp.perl.org/group/perl.perl6.users/2025/02/msg11382.html Wed, 05 Feb 2025 20:07:07 +0000 The SF Perl Raku Study Group, 01/26 at 1pm PST by Joseph Brenner &quot;In my experience, the sweet spot is to implement new modules in a<br/>_somewhat general-purpose_ fashion. The phrase &#39;somewhat<br/>general-purpose&#39; means that the module&#39;s functionality should<br/>reflect your current needs, but its interface should not. ... The<br/>word &#39;somewhat&#39; is important: don&#39;t get carried away and build<br/>something so general-purpose that it is difficult to use for your<br/>current needs.&quot;<br/><br/> John Ousterhout, Stanford University<br/> _A Philosophy of Software Design_ (2018)<br/><br/>The Raku Study Group<br/><br/>January 26, 2005 1pm in California, 9pm in the UK<br/><br/>An informal meeting: drop by when you can, show us what you&#39;ve got,<br/>ask and answer questions, or just listen and lurk.<br/><br/>Perl and programming in general are fair game, along with Raku,<br/><br/>Zoom meeting link:<br/> https://us02web.zoom.us/j/86114142481?pwd=AQaWj8tiBdAfvN5law6FTYsD61GksT.1<br/><br/>Passcode: 4RakuRoll<br/> https://www.nntp.perl.org/group/perl.perl6.users/2025/01/msg11381.html Fri, 24 Jan 2025 06:00:24 +0000 The Raku Study Group: postponed to January 26th by Joseph Brenner I&#39;ve had to cancel the announced meeting on the 19th. The next Raku Study<br/>Group is on January 26th. Hope to see you.<br/><br/><br/>https://github.com/doomvox/raku-study<br/> https://www.nntp.perl.org/group/perl.perl6.users/2025/01/msg11380.html Fri, 17 Jan 2025 23:36:25 +0000 Re: I need help understanding a match by ToddAndMargo via perl6-users On 1/16/25 1:41 AM, Todd Chester via perl6-users wrote:<br/>&gt; First I should apologize for one of my earlier posts. The first token <br/>&gt; was a bit of a jumble. I think now you just want the literal string <br/>&gt; &quot;download&quot; to start your capture.<br/><br/>Hi Bill,<br/><br/>Don&#39;t apologize. You are teaching me at trans<br/>light speed (FLT or Faster Than Light, it is<br/>coming to humanity soon). I sincerely appreciate<br/>it.<br/><br/>I am still slowly reading over your post, bit by<br/>bit, to make sure I completely understand it.<br/><br/>:-)<br/><br/>-T<br/> https://www.nntp.perl.org/group/perl.perl6.users/2025/01/msg11379.html Thu, 16 Jan 2025 23:57:39 +0000 Re: I need help understanding a match by Todd Chester via perl6-users Thank you!<br/><br/><br/>On 1/13/25 18:20, William Michels via perl6-users wrote:<br/>&gt; Hi Todd,<br/>&gt; <br/>&gt; 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 &quot;download&quot; to start your capture.<br/>&gt; <br/>&gt; 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&#39;s zero-width &quot;start-of-string&quot; regex token.<br/>&gt; <br/>&gt; If you use `^` you will capture from the start-of-string onward, in this case through the `.*?` any-character token and up to the \&gt; angle. You may not want this as it actually means the word &quot;download&quot; isn&#39;t required for you to capture that sequence of characters.<br/>&gt; <br/>&gt; I&#39;m not sure where you got the impression that `\...\` actually means anything specific in Raku. If you&#39;re asking for a match against alphanumeric characters in Raku you don&#39;t have to escape them. Anything else (e.g. punctuation) you&#39;ll have to escape. So this means if you&#39;re trying to match &quot;&gt;&quot; the &quot;greater-than&quot; sign (angle), you&#39;ll have to escape it via a backslash (e.g. `\&gt;`), or by quoting (e.g. &quot;&gt;&quot;).<br/>&gt; <br/>&gt; For non-alphanumeric characters, an unescaped punctuation characters is reserved for special &quot;metacharacter&quot; purposes: for example an unescaped &quot;.&quot; dot means &quot;any-character&quot;. You&#39;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.<br/>&gt; <br/>&gt; I&#39;ve also posted direct links to Raku regex forms, such as `&lt;?before ... &gt;` (a positive lookahead) and `&lt;?after ... &gt;` (a positive lookbehind). You can try this in the REPL:<br/>&gt; <br/>&gt; [0] &gt; my $a = &quot;XYZ&quot;<br/>&gt; XYZ<br/>&gt; [1] &gt; say $a ~~ m/ &lt;?after X &gt; Y &lt;?before Z &gt; /;<br/>&gt; &#xFF62;Y&#xFF63;<br/>&gt; <br/>&gt; Try reading that out loud in English, &quot;say $a smartmatching against a requested `m` match comprising after-X, Y, before-Z&quot;. If you read it that way, you&#39;ll understand why only the `&#xFF62;Y&#xFF63;` 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:<br/>&gt; <br/>&gt; [1] &gt; $a ~~ m/ &lt;?after X &gt; Y &lt;?before Z &gt; / andthen put $_.Str;<br/>&gt; Y<br/>&gt; <br/>&gt; I&#39;ll try to go through and correct what you wrote below. Best, Bill.<br/>&gt; <br/>&gt;&gt; On Jan 12, 2025, at 03:11, ToddAndMargo via perl6-users &lt;perl6-users@perl.org&gt; wrote:<br/>&gt;&gt;<br/>&gt;&gt; Hi Bill,<br/>&gt;&gt;<br/>&gt;&gt; Please correct my notes.<br/>&gt;&gt;<br/>&gt;&gt; Many thanks,<br/>&gt;&gt; -T<br/>&gt;&gt;<br/>&gt;&gt;<br/>&gt;&gt;<br/>&gt;&gt; Explanation:<br/>&gt;&gt; my @y = $x ~~ m:g/ &lt;?before ^ | download &gt; .*? &lt;?before \&gt; | \h+ &gt; /;<br/>&gt;&gt;<br/>&gt;&gt; `m:g` # match and global<br/>&gt; CORRECT<br/>&gt;&gt; `\...\` # the constrains (beginning and end) of the match<br/>&gt; NO, backslashes are used to escape non-alphanumeric characters, denote invisible characters (e.g. `\n`), etc.<br/>&gt;&gt; `&lt;...&gt;` # constraints of instructions inside the match<br/>&gt; NO, `&lt;?after ... &gt;` is a lookbehind and `&lt;?before ... &gt;` is a lookahead.<br/>&gt;&gt;<br/>&gt;&gt;<br/>&gt;&gt;<br/>&gt;&gt; First instruction: `&lt;?before ^ | download &gt;`<br/>&gt; NO, this should just be the literal string `download` (or `&quot;download&quot;`)<br/>&gt;&gt;<br/>&gt;&gt; `?download ^` # positive look-behind, match but don`t capture `download `<br/>&gt;&gt; # `^` means &quot;look behind&quot;<br/>&gt;&gt;<br/>&gt;&gt; `|` # This is logical &quot;OR&quot;<br/>&gt;&gt;<br/>&gt;&gt; `download ` # positive look-behind, match but don`t capture `download `<br/>&gt;&gt;<br/>&gt;&gt; summary: capture everything behind `before ` or capture just `download`<br/>&gt;&gt;<br/>&gt;&gt;<br/>&gt;&gt; Second instruction: `.*?`<br/>&gt;&gt; `.*?` # any-character, one-or-more, frugal up to the third instruction<br/>&gt; YES, CORRECT<br/>&gt;&gt;<br/>&gt;&gt;<br/>&gt;&gt; Third instruction: `&lt;?before \&gt; | \h+ &gt;`<br/>&gt; NO, SIMPLIFY THIS TO `&lt;?before \&gt;` and the match will stop when it encounters &quot;&gt;&quot; the &quot;greater-than&quot; sign (angle). Because you&#39;re using a lookahead (match characters and &quot;lookahead&quot; to find a pattern but don&#39;t capture, example ), the &quot;&gt;&quot; angle doesn&#39;t get captured.<br/>&gt;&gt;<br/>&gt;&gt; `&lt;?before \&gt;` # positive look-ahead, match but don`t capture `download \&gt;`<br/>&gt; KINDA, the actual construct is `&lt;?before \&gt; &gt;` or (even more readable), `&lt;?before &quot;&gt;&quot; &gt;`<br/>&gt;&gt; # Note that the `\` in `\&gt;` is escaping the `&gt;` and is removing<br/>&gt; KINDA, the `\` backslash in front of a non-alphanumeric is a rule in Raku. If it isn&#39;t backslashed Raku will try to interpret the non-alphanumeric as a metacharacter.<br/>&gt;&gt; # the `&gt;` from the instructions constraints and making is part<br/>&gt;&gt; # of the match<br/>&gt; The unescaped `&gt;` is part of the lookahead/lookbehind construct, either `&lt;?after ... &gt;` (lookbehind) or `&lt;?before ... &gt;` (lookahead).<br/>&gt;&gt;<br/>&gt;&gt; `|` # This is logical &quot;OR&quot;<br/>&gt; YES<br/>&gt;&gt;<br/>&gt;&gt; `\h+ ` # one-or-more horizontal whitespace character<br/>&gt; YES<br/>&gt;&gt;<br/>&gt;&gt; summary: capture everything before `before` or one-or-more whitespace characters<br/>&gt; KINDA. Match the previous tokens, and stop matching when (before) you find one-or-more whitespace characters.<br/>&gt;&gt;<br/>&gt;&gt;<br/>&gt; <br/>&gt; HTH.<br/><br/> https://www.nntp.perl.org/group/perl.perl6.users/2025/01/msg11378.html Thu, 16 Jan 2025 09:41:35 +0000 Re: Q[] question by 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/> https://www.nntp.perl.org/group/perl.perl6.users/2025/01/msg11377.html Tue, 14 Jan 2025 06:00:58 +0000 Re: I need help understanding a match by William Michels via perl6-users Hi Todd, <br/> <br/>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 &quot;download&quot; to start your capture. <br/> <br/>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&#39;s zero-width &quot;start-of-string&quot; regex token. <br/> <br/>If you use `^` you will capture from the start-of-string onward, in this case through the `.*?` any-character token and up to the \&gt; angle. You may not want this as it actually means the word &quot;download&quot; isn&#39;t required for you to capture that sequence of characters. <br/> <br/>I&#39;m not sure where you got the impression that `\...\` actually means anything specific in Raku. If you&#39;re asking for a match against alphanumeric characters in Raku you don&#39;t have to escape them. Anything else (e.g. punctuation) you&#39;ll have to escape. So this means if you&#39;re trying to match &quot;&gt;&quot; the &quot;greater-than&quot; sign (angle), you&#39;ll have to escape it via a backslash (e.g. `\&gt;`), or by quoting (e.g. &quot;&gt;&quot;). <br/> <br/>For non-alphanumeric characters, an unescaped punctuation characters is reserved for special &quot;metacharacter&quot; purposes: for example an unescaped &quot;.&quot; dot means &quot;any-character&quot;. You&#39;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. <br/> <br/>I&#39;ve also posted direct links to Raku regex forms, such as `&lt;?before ... &gt;` (a positive lookahead) and `&lt;?after ... &gt;` (a positive lookbehind). You can try this in the REPL: <br/> <br/>[0] &gt; my $a = &quot;XYZ&quot; <br/>XYZ <br/>[1] &gt; say $a ~~ m/ &lt;?after X &gt; Y &lt;?before Z &gt; /; <br/>&#xFF62;Y&#xFF63; <br/> <br/>Try reading that out loud in English, &quot;say $a smartmatching against a requested `m` match comprising after-X, Y, before-Z&quot;. If you read it that way, you&#39;ll understand why only the `&#xFF62;Y&#xFF63;` 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: <br/> <br/>[1] &gt; $a ~~ m/ &lt;?after X &gt; Y &lt;?before Z &gt; / andthen put $_.Str; <br/>Y <br/> <br/>I&#39;ll try to go through and correct what you wrote below. Best, Bill. <br/> <br/>&gt; On Jan 12, 2025, at 03:11, ToddAndMargo via perl6-users &lt;perl6-users@perl.org&gt; wrote: <br/>&gt; <br/>&gt; Hi Bill, <br/>&gt; <br/>&gt; Please correct my notes. <br/>&gt; <br/>&gt; Many thanks, <br/>&gt; -T <br/>&gt; <br/>&gt; <br/>&gt; <br/>&gt; Explanation: <br/>&gt; my @y = $x ~~ m:g/ &lt;?before ^ | download &gt; .*? &lt;?before \&gt; | \h+ &gt; /; <br/>&gt; <br/>&gt; `m:g` # match and global <br/>CORRECT <br/>&gt; `\...\` # the constrains (beginning and end) of the match <br/>NO, backslashes are used to escape non-alphanumeric characters, denote invisible characters (e.g. `\n`), etc. <br/>&gt; `&lt;...&gt;` # constraints of instructions inside the match <br/>NO, `&lt;?after ... &gt;` is a lookbehind and `&lt;?before ... &gt;` is a lookahead. <br/>&gt; <br/>&gt; <br/>&gt; <br/>&gt; First instruction: `&lt;?before ^ | download &gt;` <br/>NO, this should just be the literal string `download` (or `&quot;download&quot;`) <br/>&gt; <br/>&gt; `?download ^` # positive look-behind, match but don`t capture `download ` <br/>&gt; # `^` means &quot;look behind&quot; <br/>&gt; <br/>&gt; `|` # This is logical &quot;OR&quot; <br/>&gt; <br/>&gt; `download ` # positive look-behind, match but don`t capture `download ` <br/>&gt; <br/>&gt; summary: capture everything behind `before ` or capture just `download` <br/>&gt; <br/>&gt; <br/>&gt; Second instruction: `.*?` <br/>&gt; `.*?` # any-character, one-or-more, frugal up to the third instruction <br/>YES, CORRECT <br/>&gt; <br/>&gt; <br/>&gt; Third instruction: `&lt;?before \&gt; | \h+ &gt;` <br/>NO, SIMPLIFY THIS TO `&lt;?before \&gt;` and the match will stop when it encounters &quot;&gt;&quot; the &quot;greater-than&quot; sign (angle). Because you&#39;re using a lookahead (match characters and &quot;lookahead&quot; to find a pattern but don&#39;t capture, example ), the &quot;&gt;&quot; angle doesn&#39;t get captured. <br/>&gt; <br/>&gt; `&lt;?before \&gt;` # positive look-ahead, match but don`t capture `download \&gt;` <br/>KINDA, the actual construct is `&lt;?before \&gt; &gt;` or (even more readable), `&lt;?before &quot;&gt;&quot; &gt;` <br/>&gt; # Note that the `\` in `\&gt;` is escaping the `&gt;` and is removing <br/>KINDA, the `\` backslash in front of a non-alphanumeric is a rule in Raku. If it isn&#39;t backslashed Raku will try to interpret the non-alphanumeric as a metacharacter. <br/>&gt; # the `&gt;` from the instructions constraints and making is part <br/>&gt; # of the match <br/>The unescaped `&gt;` is part of the lookahead/lookbehind construct, either `&lt;?after ... &gt;` (lookbehind) or `&lt;?before ... &gt;` (lookahead). <br/>&gt; <br/>&gt; `|` # This is logical &quot;OR&quot; <br/>YES <br/>&gt; <br/>&gt; `\h+ ` # one-or-more horizontal whitespace character <br/>YES <br/>&gt; <br/>&gt; summary: capture everything before `before` or one-or-more whitespace characters <br/>KINDA. Match the previous tokens, and stop matching when (before) you find one-or-more whitespace characters. <br/>&gt; <br/>&gt; <br/> <br/>HTH. https://www.nntp.perl.org/group/perl.perl6.users/2025/01/msg11376.html Tue, 14 Jan 2025 02:20:30 +0000 Re: Q[] question by 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/ https://www.nntp.perl.org/group/perl.perl6.users/2025/01/msg11375.html Mon, 13 Jan 2025 10:25:21 +0000 Re: I need help understanding a match by 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/> https://www.nntp.perl.org/group/perl.perl6.users/2025/01/msg11374.html Sun, 12 Jan 2025 11:18:23 +0000