On 2019-11-30 00:57, William Michels via perl6-users wrote:
Hi Todd, You should definitely write up some code and post it here on
the mailing list, so we all can test it. I found an error "Cannot
modify an immutable Match" a while back (Oct 2019), and it turned out
to be a bug:

https://www.nntp.perl.org/group/perl.perl6.users/2019/10/msg7067.html

Best Regards, Bill.

Hi Bill,

A few days ago I broke my rule ago I reporting to

https://github.com/rakudo/rakudo/issues/

It is a waste of my time as it is too hard to get
part the guard dog.   I am going to go back to
not reporting them.  I report a lot to Fedora.  They
are very professional about it.  I report to Libre
Office a lot too.  They have an impressive guard dogs
too, but if you keep arguing with him long enough,
a developer will eventually see it and overrule the
guard dog.

But here is a different story.


Windows 7, sp1, x64
rakudo-star-2019.03-x86_64 (JIT).msi

Okay, first a test.

K:\Windows\NtUtil>perl6 -e "say 3 % 2;"
1

Yup modulus works


<UUID.pl6>
#`{

Print out the UUID's of partitions that have a label of BACKUP

C:\NtUtil>perl6 UUID.pl6
partitons with the label of BACKUP:
\\?\Volume{9b358c63-e345-401d-828c-c5f99066269b}\
\\?\Volume{9a60e05f-39b1-41be-8aad-acbe62f78ee4}\
\\?\Volume{9fec274f-2a58-4a44-804d-f7a5777aaa57}\
\\?\Volume{30347b97-d2aa-4b67-a163-dd7e3f133cdf}\
\\?\Volume{981c447a-b600-4fbb-ae44-c743a393e3c5}\
}


my @Result;
my Str $RtnStr;
my Str $DeviceID;
my Str $Label;
my Str $Name;

@Result = qx ( wmic.exe volume get deviceid,label,name ).lines;

say "partitions with the label of BACKUP:";
for @Result.kv -> $I, $Line {
   # my $J = $I % 2;
   # if $J == 1  ||  $Line.chars == 0  { next; };
   if $I % 2 == 1 { next; }

   $DeviceID = $Line.substr(0..48);
   # w7
   # $Label    = $Line.substr(51..66);
   # $Name     = $Line.substr(69..71);

   # w10
   $Label    = $Line.substr(51..58).trim;
   $Name     = $Line.substr(61..63);

   if $Label eq "BACKUP"  {
      say $DeviceID;
      if $Name.contains( ":" )  {
          say "WARNING: $DeviceID is mounted as $Name.  Dismounting";
          $RtnStr = qqx ( MountVol.exe $Name /D );
      }
   }

   # say "Device ID <" ~ $DeviceID ~ ">";
   # say "Label     <" ~ $Label    ~ ">";
   # say "name      <" ~ $Name     ~ ">";
   # say "";
}
</UUID.pl6


K:\Windows\NtUtil>perl6 -c UUID.pl6
Syntax OK

Hmmmmmmm......


K:\Windows\NtUtil>perl6 UUID.pl6
partitions with the label of BACKUP:
Cannot modify an immutable Int (0)
  in block <unit> at UUID.pl6 line 27

24: for @Result.kv -> $I, $Line {
25:    # my $J = $I % 2;
26:    # if $J == 1  ||  $Line.chars == 0  { next; };
27:    if $I % 2 = 0 { next; }
27:

Hmmmm....

Did you catch my error on line 27?   It should have been
"==" not "=".

So maybe the guard dog would have been right on this one.

But you would have though that "$I % 2 = 0" would have
thrown a compiler error.

K:\Windows\NtUtil>perl6 -e "if 3 % 2 = 1 {say \"odd\"; }"
Cannot modify an immutable Int (1)
  in block <unit> at -e line 1


-T

Reply via email to