On 11/11/25 6:22 AM, Peter Pentchev wrote:
The "exitcode" method, on the other hand, is what Raku creates
automatically when the source code says "has $.exitcode". It will
read the value of the internal "$.exitcode" field and it will return
To be a bit more precise, for methods of that class that will have
access to the internal field, the field itself is called "$!exitcode".

G'luck,
Peter


Hi Peter,

Maybe this will help with my issue with the documentation.
You want to use run and before.  You get to the run page
and what do you find?  It looks like a summary of a
specification sheet.  It is not at all helpful.

I am reminded of University calculus.   Supposedly the hardest
coarse was the one that was taught by a teacher that explained
the mechanics of a process first, sent us home to work on
problems, then the next lesson explained the theory.  I loved
the course and got a perfect A in it.  Then the next calculus
course was taught by a teacher that taught the theory, then
sent us home to solve problems.  The next lesson, he repeated
it.  The course about killed me.  I got a C in it.  It was
my worse grade in Uni.

In my own paper on run, the first two to lines are a quick
introduction as to what run does:

    Run allows Raku to call and external program outside
    the “shell”. Results are given back in OOP format using
    the Proc class.

Simple and direct.  The next section is my table of contents.

The third section shows links to my references.

The fourth section is the simplest example I could think of.
No showing off or bragging.

    Quick “run” example:

        #!/usr/bin/raku

        # Note: use "shell" with wild cards ("*", "?")

        my @args = "ls", "-al", Q[RunTest.raku];
        my Proc $p = run( "ls", "-al", Q[RunTest.raku], :err, :out );

        my int  $x = $p.exitcode;      #  `$?` in bash
        my Str  $y = $p.err.slurp(:close);
        my Str  $z = $p.out.slurp(:close);

        print "\$x (exitcode) = <$x>\n";
        print "\$z (out)      = $z\n";
        print "\$y (err)      = $y\n";


    Result:
        $x (exitcode) = <0>
$z (out) = -rwxrwxrwx. 1 tony root 858 Nov 2 22:40 RunTest.raku
        $y (err)      =

I work up to more complicated from there.


Now from my own coding:

( $ReturnStr, $CurlStatus ) = CurlImpersonate $ClickHere, $NewFileName, $SubName ;
   if $CurlStatus eq True  {
       ...
   } else {
       ...
   }


Notice how the FIRST thing I check is the exit code?
That is the most import part.  Did the call work or not.

And who cared how it got there. Method or anything other
way.  Is it zero on not is all the is important.  If
it is not zero, I do not care what is in $ReturnStr.

The document on run is absolutely accurate and pretty
much useless.

-T

Reply via email to