develooper Front page | perl.perl6.users | Postings from August 2022

Re: something between run and qx() ?

Thread Previous | Thread Next
From:
Elizabeth Mattijsen
Date:
August 4, 2022 11:39
Subject:
Re: something between run and qx() ?
Message ID:
64A2E7FB-E101-4A2E-877C-C18D19FFB857@dijkmat.nl
> On 4 Aug 2022, at 10:35, Marc Chantreux <mc@unistra.fr> wrote:
> 
> hello people,
> 
> I found myself choosing between
> 
> raku -e '
> 	(run :out, <
> 		dpkg-query -f ${db-fsys:Files} -W gnuplot*
> 	> ).out>>.lines>>.trim>>.grep(*.IO.f)>>.say'
> 
> and
> 
> raku -e '
> 	qx<
> 		dpkg-query -f \${db-fsys:Files} -W gnuplot\*
> 	>.lines.trim>>.grep(*.IO.f)>>.say'
> 
> I really love the qx syntax but
> 
> * it runs an extra useless sh processus
> * I need to quote the shell symbols
> 
> I read the Proc documentation and tried to see if there was another
> command or an adverb to the qx construction (something like :r for run).
> 
> What I really would like to write is:
> 
> raku -e ' qx:r< dpkg-query -f ${db-fsys:Files} -W gnuplot* >.lines>>.grep(*.IO.f)>>.say '

I believe you could use App::Rak for that:


    $ zef install App::Rak
    $ dpkg-query -f ${db-fsys:Files} -W gnuplot* | rak '*.trim.IO.f' --/show-line-number


Liz
Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About