Re: $? and $! equivalents
On Fri, 14 Sep 2018 18:15:21 -0400 Brandon Allbery wrote: > Magic variables make multiple threads impossible, which is why perl 5 > is stuck with ithreads: what happens if two threads each "run" > something at around the same time? > > In Perl 6, you have a Proc object for each subprocess, and can query > it for its status and/or result code; for things like sub run, the > Proc should be the return value. > > On Fri, Sep 14, 2018 at 6:08 PM Parrot Raiser <1parr...@gmail.com> > wrote: > > > This is probably going to be a forehead-slapper, but I can't find a > > reference in either perlintro.com or http://docs.perl6.org/ > > (5to6-perlfunc or top-down) for the equivalents of $? and $! in > > P6.What are they? > > > > I want to be able to "run" or "shell" programs, then examine return > > codes and errors. (The immediate case is to see if a program name is > > already in use by running "which $progname". ) > > > > this is very good to know.
Re: $? and $! equivalents
OK, different paradigm, different methods. Thanks. Another couple of entries for the "differences" list? Even a note the thing doesn't exist saves fruitless further searching. On 9/14/18, Brad Gilbert wrote: > On Fri, Sep 14, 2018 at 5:08 PM Parrot Raiser <1parr...@gmail.com> wrote: >> >> This is probably going to be a forehead-slapper, but I can't find a >> reference in either perlintro.com or http://docs.perl6.org/ >> (5to6-perlfunc or top-down) for the equivalents of $? and $! in >> P6.What are they? >> >> I want to be able to "run" or "shell" programs, then examine return >> codes and errors. (The immediate case is to see if a program name is >> already in use by running "which $progname". ) > >my $proc = run , :out, :!in; >say $proc.out.slurp; >say $proc.exitcode; >
Re: $? and $! equivalents
On Fri, Sep 14, 2018 at 5:08 PM Parrot Raiser <1parr...@gmail.com> wrote: > > This is probably going to be a forehead-slapper, but I can't find a > reference in either perlintro.com or http://docs.perl6.org/ > (5to6-perlfunc or top-down) for the equivalents of $? and $! in > P6.What are they? > > I want to be able to "run" or "shell" programs, then examine return > codes and errors. (The immediate case is to see if a program name is > already in use by running "which $progname". ) my $proc = run , :out, :!in; say $proc.out.slurp; say $proc.exitcode;
Re: $? and $! equivalents
Magic variables make multiple threads impossible, which is why perl 5 is stuck with ithreads: what happens if two threads each "run" something at around the same time? In Perl 6, you have a Proc object for each subprocess, and can query it for its status and/or result code; for things like sub run, the Proc should be the return value. On Fri, Sep 14, 2018 at 6:08 PM Parrot Raiser <1parr...@gmail.com> wrote: > This is probably going to be a forehead-slapper, but I can't find a > reference in either perlintro.com or http://docs.perl6.org/ > (5to6-perlfunc or top-down) for the equivalents of $? and $! in > P6.What are they? > > I want to be able to "run" or "shell" programs, then examine return > codes and errors. (The immediate case is to see if a program name is > already in use by running "which $progname". ) > -- brandon s allbery kf8nh allber...@gmail.com
$? and $! equivalents
This is probably going to be a forehead-slapper, but I can't find a reference in either perlintro.com or http://docs.perl6.org/ (5to6-perlfunc or top-down) for the equivalents of $? and $! in P6.What are they? I want to be able to "run" or "shell" programs, then examine return codes and errors. (The immediate case is to see if a program name is already in use by running "which $progname". )