3 ms·
In perl, you can pass a string to a command's stdin. use IPC::Cmd qw{run_forked}; my $applescript = q{display alert "Hello, world!"} my $results = run_fo
by sciurus 15y ago
In perl, you can pass a string to a command's stdin.
use IPC::Cmd qw{run_forked};
my $applescript = q{display alert "Hello, world!"}
my $results = run_forked( 'osascript', {child_stdin => $applescript} );
- axiak 15y agoOf course, you're using a package from CPAN. This article mentioned envoy from pypi but refutes it as being "not part of the standard library". The two good solutions he mentions (communicate and envoy) he dismisses for what seem silly or non-reasons to me. (an ill-defined "clumsy" and "not part of the stdlib").
- sciurus 15y agoI'm not using a package from CPAN. IPC::Cmd is one of Perl's core modules, just like subprocess is one of Python's standard libraries. You can find a list of all of the modules distributed with Perl at http://perldoc.perl.org/perlmodlib.html#THE-PERL-MODULE-LIBRARY http://perldoc.perl.org/perlmodlib.html#THE-PERL-MODULE-LIBR... You can find links to their documentation beginning at http://perldoc.perl.org/index-modules-A.html http://perldoc.perl.org/index-modules-A.html