Re: Malformed UTF-8 ???

2018-10-20 Thread ToddAndMargo via perl6-users
On 10/19/18 7:58 PM, ToddAndMargo via perl6-users wrote: if    $StdErr  { $proc  = run( @RunArray, :err, :out, :enc ); }    elsif $StdOut  { $proc  = run( @RunArray,   :out, :enc ); }  # STDERR goes to the terminal    else   { $proc  = run( @RunArray, :err, :out, :enc 

Re: Malformed UTF-8 ???

2018-10-19 Thread ToddAndMargo via perl6-users
On 10/19/18 7:58 PM, ToddAndMargo via perl6-users wrote: sub RunNoShellAll( Str $RunString, Bool $StdOut, Bool $StdErr, Bool $Code, --> List ) { Had to remove the --> List to get rid of the random core dumps https://github.com/rakudo/rakudo/issues/2403

Re: Malformed UTF-8 ???

2018-10-19 Thread ToddAndMargo via perl6-users
On 10/16/18 3:59 AM, ToddAndMargo via perl6-users wrote: This is going through a rewrite.  So, don't help me until I clean this up.  I hope to have some time Friday, but maybe not.  I will get back. -T Rewrite worked! sub RunNoShellAll( Str $RunString, Bool $StdOut, Bool $StdErr, Bool

Re: Malformed UTF-8 ???

2018-10-16 Thread ToddAndMargo via perl6-users
On 10/15/18 6:46 PM, Curt Tilmes wrote: On Mon, Oct 15, 2018 at 9:44 PM Brandon Allbery > wrote: Isn't the point that it's $ReturnStr that's throwing the immutable error, not $RunString? That's what I see in the thread history You're right.  My thinko. 

Re: Malformed UTF-8 ???

2018-10-15 Thread Curt Tilmes
On Mon, Oct 15, 2018 at 9:44 PM Brandon Allbery wrote: > Isn't the point that it's $ReturnStr that's throwing the immutable error, > not $RunString? That's what I see in the thread history > You're right. My thinko. Sorry. > On Mon, Oct 15, 2018 at 9:40 PM Curt Tilmes wrote: > >> >> >> On

Re: Malformed UTF-8 ???

2018-10-15 Thread Brandon Allbery
Isn't the point that it's $ReturnStr that's throwing the immutable error, not $RunString? That's what I see in the thread history. On Mon, Oct 15, 2018 at 9:40 PM Curt Tilmes wrote: > > > On Mon, Oct 15, 2018 at 9:34 PM ToddAndMargo via perl6-users < > perl6-users@perl.org> wrote: > >> On

Re: Malformed UTF-8 ???

2018-10-15 Thread Curt Tilmes
On Mon, Oct 15, 2018 at 9:34 PM ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > On 10/15/18 9:04 AM, Larry Wall wrote: > > This almost certainly means that $ReturnStr is a read-only paramater to > > a routine. Add "is copy" to the declaration if you want to modify it. > > I am not

Re: Malformed UTF-8 ???

2018-10-15 Thread ToddAndMargo via perl6-users
On 10/15/18 9:04 AM, Larry Wall wrote: On Sun, Oct 14, 2018 at 02:03:23AM -0700, ToddAndMargo via perl6-users wrote: : On 10/13/18 3:02 AM, ToddAndMargo via perl6-users wrote: : >Hi All, : > : > if  $StdOut  { $ReturnStr = $$proc.out.slurp-rest; } : > : >gives me : > : &g

Re: Malformed UTF-8 ???

2018-10-15 Thread ToddAndMargo via perl6-users
> On Sun, Oct 14, 2018 at 11:30 AM ToddAndMargo via perl6-users > mailto:perl6-users@perl.org>> wrote: > > On 10/14/18 3:08 AM, Ralph Mellor wrote: > > This code works fine: > > > > spurt 'foo', 'bar'; > > my Str $ReturnStr = ""; > > $ReturnStr =

Re: Malformed UTF-8 ???

2018-10-15 Thread Larry Wall
On Sun, Oct 14, 2018 at 02:03:23AM -0700, ToddAndMargo via perl6-users wrote: : On 10/13/18 3:02 AM, ToddAndMargo via perl6-users wrote: : >Hi All, : > : > if  $StdOut  { $ReturnStr = $$proc.out.slurp-rest; } : > : >gives me : > : > Malformed UTF-8 : &

Re: Malformed UTF-8 ???

2018-10-14 Thread Ralph Mellor
It's redundant for this code. `$foo` means data that's to be treated as either a single item or as a single item container containing a single item. `$$foo` means put the single item in $foo into a single item container containing it. Given that this appears on the right of `=` the single item

Re: Malformed UTF-8 ???

2018-10-14 Thread Tom Browder
On Sun, Oct 14, 2018 at 5:13 AM Ralph Mellor wrote: > > Almost certainly your problem is elsewhere. What is the meaning of the double dollar sign ($$) in the problem code? -Tom

Re: Malformed UTF-8 ???

2018-10-14 Thread Ralph Mellor
I see no significant difference beyond the inside of your proc and the outside of the code you've shown. The extra `$` in `$$proc` is redundant. (I don't understand why you have it.) The `(...)` is the same as my `: ...`. It can wait until you switch to `slurp`. I wouldn't expect it to make

Re: Malformed UTF-8 ???

2018-10-14 Thread ToddAndMargo via perl6-users
On 10/14/18 3:08 AM, Ralph Mellor wrote: This code works fine: spurt 'foo', 'bar'; my Str $ReturnStr = ""; $ReturnStr = 'foo'.IO.open.slurp-rest: enc => 'utf8-c8'; say $ReturnStr; # bar Try it with my layout: $ReturnStr = $$proc.out.slurp-rest( enc => 'utf8-c8' );

Re: Malformed UTF-8 ???

2018-10-14 Thread ToddAndMargo via perl6-users
> > > On Sun, Oct 14, 2018 at 11:08 AM Ralph Mellor > wrote: > > Are you sure the error message you showed applies to the line you > showed? > > This code works fine: > > spurt 'foo', 'bar'; > my Str $ReturnStr = ""; > $ReturnStr =

Re: Malformed UTF-8 ???

2018-10-14 Thread Ralph Mellor
Almost certainly your problem is elsewhere. When you refer to a variable as a *value* then you get its *value*. So: return $ReturnStr returns $ReturnStr's *value*, not the variable. Your code returns such a value, which will be an immutable string. So I think the error message you're getting

Re: Malformed UTF-8 ???

2018-10-14 Thread Ralph Mellor
Are you sure the error message you showed applies to the line you showed? This code works fine: spurt 'foo', 'bar'; my Str $ReturnStr = ""; $ReturnStr = 'foo'.IO.open.slurp-rest: enc => 'utf8-c8'; say $ReturnStr; # bar -- raiph On Sun, Oct 14, 2018 at 10:52 AM ToddAndMargo via perl6-users <

Re: Malformed UTF-8 ???

2018-10-14 Thread ToddAndMargo via perl6-users
On Sun, Oct 14, 2018 at 10:35 AM ToddAndMargo via perl6-users mailto:perl6-users@perl.org>> wrote: On 10/14/18 2:29 AM, Ralph Mellor wrote: > In P6 "assign" means use of `=`. > > And "assign to" means to copy into the thing on the left of the `=`. > > And to copy

Re: Malformed UTF-8 ???

2018-10-14 Thread Ralph Mellor
I just tried slurp-rest with a specified encoding and it worked fine. Are you sure you don't bind $ReturnStr between the declaration you've shiown and the use you've shown? -- raiph On Sun, Oct 14, 2018 at 10:35 AM ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > On 10/14/18 2:29

Re: Malformed UTF-8 ???

2018-10-14 Thread ToddAndMargo via perl6-users
On 10/14/18 2:29 AM, Ralph Mellor wrote: In P6 "assign" means use of `=`. And "assign to" means to copy into the thing on the left of the `=`. And to copy into something the thing has to be a mutable container. The error message is saying that $ReturnStr is bound to an immutable value (eg a

Re: Malformed UTF-8 ???

2018-10-14 Thread Ralph Mellor
ToddAndMargo via perl6-users wrote: >> > Hi All, >> > >> > if $StdOut { $ReturnStr = $$proc.out.slurp-rest; } >> > >> > gives me >> > >> > Malformed UTF-8 >> > >> > How do I clean up $$proc.out.slurp-rest ?? >> > >> > Many thanks, >> > -T >> >> This does not work: >> >> if $StdOut { $ReturnStr = $$proc.out.slurp-rest( enc => 'utf8-c8' ); } >> >> Can not assign to an immutable value >> >

Re: Malformed UTF-8 ???

2018-10-14 Thread ToddAndMargo via perl6-users
On 10/14/18 2:21 AM, Ralph Mellor wrote: OK. That makes sense. So the program that you're running for the $proc is producing malformed UTF8. Why don't you fix that rather than clean up afterwards? -- raiph Hi Raiph, I am reading the contents from a web page through my "curl" interface

Re: Malformed UTF-8 ???

2018-10-14 Thread Ralph Mellor
perl6-users wrote: > > Hi All, > > > > if $StdOut { $ReturnStr = $$proc.out.slurp-rest; } > > > > gives me > > > > Malformed UTF-8 > > > > How do I clean up $$proc.out.slurp-rest ?? > > > > Many thanks, > > -T > > This doe

Re: Malformed UTF-8 ???

2018-10-14 Thread Ralph Mellor
gt; >> On Sat, Oct 13, 2018 at 11:18 AM ToddAndMargo via perl6-users > >> mailto:perl6-users@perl.org>> wrote: > >> > >> Hi All, > >> > >>if $StdOut { $ReturnStr = $$proc.out.slurp-rest; } > >> > >>

Re: Malformed UTF-8 ???

2018-10-14 Thread ToddAndMargo via perl6-users
On 10/13/18 3:02 AM, ToddAndMargo via perl6-users wrote: Hi All, if  $StdOut  { $ReturnStr = $$proc.out.slurp-rest; } gives me Malformed UTF-8 How do I clean up $$proc.out.slurp-rest ?? Many thanks, -T This does not work: if $StdOut { $ReturnStr = $$proc.out.slurp-rest( enc

Re: Malformed UTF-8 ???

2018-10-13 Thread ToddAndMargo via perl6-users
>> >> Hi All, >> >>if $StdOut { $ReturnStr = $$proc.out.slurp-rest; } >> >> gives me >> >>Malformed UTF-8 >> >> How do I clean up $$proc.out.slurp-rest ?? >> >> Many thanks, >> -T On 10/13/18 8:1

Re: Malformed UTF-8 ???

2018-10-13 Thread Brad Gilbert
> > gives me > > Malformed UTF-8 > > How do I clean up $$proc.out.slurp-rest ?? > > Many thanks, > -T

Re: Malformed UTF-8 ???

2018-10-13 Thread Ralph Mellor
Why are you asking about cleaning something up? Is it because you thought `Malformed UTF-8` was an error message? If so, great, because it IS an error message. If not, you need to know that Malformed UTF-8 is an error message and we need to think about how to make that more clear. So that's

Malformed UTF-8 ???

2018-10-13 Thread ToddAndMargo via perl6-users
Hi All, if $StdOut { $ReturnStr = $$proc.out.slurp-rest; } gives me Malformed UTF-8 How do I clean up $$proc.out.slurp-rest ?? Many thanks, -T

Malformed UTF-8 ???

2018-10-13 Thread ToddAndMargo via perl6-users
Hi All, if $StdOut { $ReturnStr = $$proc.out.slurp-rest; } gives me Malformed UTF-8 How do I clean up $$proc.out.slurp-rest ?? Many thanks, -T

Re: Malformed UTF-8?

2018-06-16 Thread ToddAndMargo
On Sat, Jun 16, 2018 at 1:09 AM ToddAndMargo <mailto:toddandma...@zoho.com>> wrote: rakudo-pkg-Fedora28-2018.05-01.x86_64.rpm $ perl6 -v This is Rakudo version 2018.05 built on MoarVM version 2018.05 implementing Perl 6.c. What did I do wrong, this time? Malf

Re: Malformed UTF-8?

2018-06-16 Thread ToddAndMargo
least one entry with malformed UTF-8.   So, I guess a look at how @Logs is populated is in order. Eirik Hi Eirik and Brandon, I had mistaken the error as a "compiler" error, not a run time error. I will put some debugging and traps in to make sure I am getting the proper data befo

Re: Malformed UTF-8?

2018-06-16 Thread The Sidhekin
that code, and it was handling directory entries ... ah, but it used to read ls output from STDIN ... right ... Either way, the data (file or directory) has been read already, unless @Logs is seriously lazy. And it has at least one entry with malformed UTF-8. So, I guess a look at how @Logs is populated is

Re: Malformed UTF-8?

2018-06-16 Thread Brandon Allbery
.05 built on MoarVM version 2018.05 > implementing Perl 6.c. > > > What did I do wrong, this time? > > Malformed UTF-8 >in sub RotateZipFile at /home/linuxutil/CimCheck.pl6 line 290 > > 290: @ReverseLogs = @Logs.sort: {my ($month, $day, $year, $hour, > $minu

Malformed UTF-8?

2018-06-15 Thread ToddAndMargo
rakudo-pkg-Fedora28-2018.05-01.x86_64.rpm $ perl6 -v This is Rakudo version 2018.05 built on MoarVM version 2018.05 implementing Perl 6.c. What did I do wrong, this time? Malformed UTF-8 in sub RotateZipFile at /home/linuxutil/CimCheck.pl6 line 290 290: @ReverseLogs = @Logs.sort: {my