On 06/20/2018 08:15 AM, Theo van den Heuvel wrote:
Hi all,

trying to make sense of the documentation on run: https://docs.perl6.org/routine/run. In particular the last part. I don't  understand the adverbs :out and : err there. Can I set it up so that the output is piped into a file directly? If so how would I write that?

I know I could use shell for that, but I doubt that is necessary.

[On first reading I found the doc confusing because it start with a hairy example. WHy would anyone wish to write to a file named '>foo.txt'? How can that be the first example?]

Thanks,



Hi Theo,

I wrote a module for "run" that may be useful.  Let
me know if you want it.  It looks like this:

   ( RtnStr, RtnCode )         =    RunNoShell( "cat --number $MyDir" );
   ( RtnStr, RtnErr, RtnCode ) = RunNoShellErr( "cat --number $MyDir" );

It removes having to quote each parameter in the run string.
You just write it like you were in a command shell.  The returned
error code ($? in bash) is really handy to have (0=true,
not 0 = false in bash).

It also shows what :out and :err are all about.

-T

Reply via email to