Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^2: Perl as interactive shell?

by LanX (Saint)
on May 13, 2017 at 13:55 UTC ( [id://1190190]=note: print w/replies, xml ) Need Help??


in reply to Re: Perl as interactive shell?
in thread Perl as interactive Shell?

Thanks that's nice! :)

IPC::Run is certainly interesting, but it'd need a nicer syntax to be usable in a CLI.

IPC::Run3::Shell already looks much better, but I'd opt to use it primarily for non-standard executables which can't be implemented in Perl. (like with powertools )

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!

Replies are listed 'Best First'.
Re^3: Perl as interactive shell?
by haukex (Archbishop) on May 13, 2017 at 16:36 UTC
    IPC::Run3::Shell already looks much better, but I'd opt to use it primarily for non-standard executables which can't be implemented in Perl.

    Agreed, and I wouldn't normally shell out to things that Perl can do natively either. Sometimes, if I'm writing a one-off script that's not meant for production, I might call find, but then again I've started using File::Find::Rule more often (even though I've measured it and it's not nearly as fast as File::Find or find). Anyway, I grepped my code and here are two examples of how I've actually used the module, in the first one I remember that in that particular case, simply calling the convert program was much faster to implement than getting Image::Magick set up. Especially if the scripts are not meant for a production environment, speed of development is often what it's about; depending on what one has the most experience with, remembering or looking up the command-line arguments can be faster than finding the appropriate Perl module.

    use IPC::Run3::Shell { fail_on_stderr=>1 }, qw/convert/; convert $img, '-auto-orient', '-resize', '300x300', $thumb; use IPC::Run3::Shell qw/gs/; gs({fail_on_stderr=>1,show_cmd=>1}, '-o',$OUTPUT, '-sDEVICE=pdfwrite', ..., '-f',$INPUT);

    Update: Minor re-wording.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1190190]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2024-04-23 06:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found