Command-Run
view release on metacpan or search on metacpan
A key advantage of this mechanism is that **callee modules typically
require no modification** to work with nofork+raw mode.
Many Perl modules use `use open` pragma or equivalent to set up
encoding layers on standard I/O:
package App::ansicolumn;
use open IO => ':utf8', ':std'; # sets :encoding(utf8) on STDIO
This works transparently because of execution order. When using
nofork mode with method chaining:
require App::ansicolumn; # (1) module loaded here
Command::Run->new
->command(\&ansicolumn, @args)
->with(stdin => $text, nofork => 1, raw => 1)
->update # (2) STDOUT redirected here
->data;
At step (1), `require` loads the module and `use open ':std'`
lib/Command/Run.pm view on Meta::CPAN
A key advantage of this mechanism is that B<callee modules typically
require no modification> to work with nofork+raw mode.
Many Perl modules use C<use open> pragma or equivalent to set up
encoding layers on standard I/O:
package App::ansicolumn;
use open IO => ':utf8', ':std'; # sets :encoding(utf8) on STDIO
This works transparently because of execution order. When using
nofork mode with method chaining:
require App::ansicolumn; # (1) module loaded here
Command::Run->new
->command(\&ansicolumn, @args)
->with(stdin => $text, nofork => 1, raw => 1)
->update # (2) STDOUT redirected here
->data;
At step (1), C<require> loads the module and C<use open ':std'>
( run in 1.918 second using v1.01-cache-2.11-cpan-39bf76dae61 )