Re: proc?

[email protected] (ToddAndMargo via perl6-users) Wed, 29 Oct 2025 15:06:26 -0700
Newsgroups perl.perl6.users
Message-ID <[email protected]>
On 10/29/25 7:12 AM, Bruce Gray wrote:
> 
> 
>> On Oct 29, 2025, at 06:10, ToddAndMargo via perl6-users <[email protected]> wrote:
>>
>> On 10/29/25 4:04 AM, ToddAndMargo via perl6-users wrote:
>>> On 10/29/25 4:00 AM, Bruce Gray wrote:
>>>>
>>>>
>>>>> On Oct 29, 2025, at 05:51, ToddAndMargo via perl6-users <perl6- [email protected]> wrote:
>>>>>
>>>>> Hi All,
>>>>>
>>>>> I use "run" a lot.
>>>>>
>>>>> https://docs.raku.org/routine/run
>>>>>
>>>>> It looks to me like "proc" is an OOP construction.
>>>>>
>>>>> Where do I find its declaration so I can figure out
>>>>> what all its members are?  (The above link does not
>>>>> define it or I am blind.)
>>>>>
>>>>> So far I know:
>>>>>    $proc.exitcode
>>>>>    $proc.err.slurp(:close)
>>>>>    $proc.out.slurp(:close)
>>>>>
>>>>> Yours in confusion,
>>>>> -T
>>>>
>>>> In https://docs.raku.org/routine/run , in the sentence "Runs an external command without involving a shell and returns a Proc object.", the word "Proc" is a link to https://docs.raku.org/type/Proc .
>>>>
>>>> That link contains the list of methods:
>>>>       new
>>>>       sink
>>>>       spawn
>>>>       shell
>>>>       command
>>>>       Bool
>>>>       pid
>>>>       exitcode
>>>>       signal
>>>>
>>>> Let's say "bleary-eyed"; kinder than "blind", and much more temporary :^)
>>> I see "exitcode", but I do not see .err or .out.
>>> Time to wash my eyes out?
>>
>> Found it where you said:
>>
>> method new(Proc:U:
>>         :$in = '-',
>>         :$out = '-',
>>         :$err = '-',
>>         Bool :$bin = False,
>>         Bool :$chomp = True,
>>         Bool :$merge = False,
>>         Str:D :$enc = 'UTF-8',
>>         Str:D :$nl = "\n",
>>     --> Proc:D)
>>
>> What is .bin?  Binary?  Binary what?  Is somethings
>> returing binary?
>>
>> What is .chomp?
>>
>> What is $enc?  Encrypted?  How does that work?
>>
>> Is .nl New Line?  And I presume that is the
>> returned text?  Does it conflict with .bin?
>>
> 
> On https://docs.raku.org/type/Proc , using Cmd-F (Edit->Find in Page) in my Firefox browser on MacOS, I see that [$bin, $chomp, $merge, $enc, $nl] are all defined as *named* *parameters* to the constructors (not *methods* callable on the object, so calling `.bin` on the object won't work, and searching for `.bin` will not find them, but `$bin` can be found).
> The text at the end of the constructors (`new` and `shell`) is:
> 	$bin controls whether the streams are handled as binary (i.e. Blob object) or text (i.e. Str objects).
> 	If $bin is False, $enc holds the character encoding to encode strings sent to the input stream
> 		and decode binary data from the output and error streams.
> 	With $chomp set to True, newlines are stripped from the output and err streams when reading with lines or get.
> 	$nl controls what your idea of a newline is.
> 	If $merge is set to True, the standard output and error stream end up merged in $proc.out.
> 
> The [`.err`, `.out`] methods that you asked about in your prior email *do* exist on the `Proc` object, but are also named parameters to the constructors, so can be found by searching `$err` and `$out`. For these, an argument could be made that they should have their own additional `Method` entries in the `Proc` page, but I am not awake enough to make said argument yet.
> 


Thank you!

Some nore questions:

Why do I need too add  :err, :out on the run line?