See also perlipc - Perl のプロセス間通信 (シグナル, fifo, パイプ, 安全な副プロセス, ソケット, セマフォ) 【perldoc.jp】
system "$CMD";
open $in, "| $CMD";
print $in "hoge";
close $in;
| # diff -u /usr/bin/innobackupex-1.5.1 innobackupex-1.5.1 | |
| --- /usr/bin/innobackupex-1.5.1 2010-11-12 16:13:38.000000000 +0900 | |
| +++ innobackupex-1.5.1 2011-03-14 13:17:24.000000000 +0900 | |
| @@ -1134,7 +1134,8 @@ | |
| my $options = get_mysql_options(); | |
| # run mysql as a child process with a pipe connection | |
| $now = current_time(); | |
| - print STDERR "$now $prefix Starting mysql with options: $options\n"; | |
| + (my $prt_options = $options) =~ s/--password=[^ ]+ /--password=xxxxxxxx /g; | |
| + print STDERR "$now $prefix Starting mysql with options: $prt_options\n"; |
| use strict; | |
| use warnings; | |
| use Furl; | |
| use JSON; | |
| use Encode; | |
| use Web::Scraper; | |
| my $furl = Furl->new; | |
| my $scraped = scraper { |
| find /path/to/dir/ -type f | time parallel --eta 'rsync -aRz --compress-level=1 {} remote:/' |
| use strict; | |
| use warnings; | |
| use IO::Handle; | |
| my ($parent_in, $parent_out); | |
| my ($child_in, $child_out); | |
| pipe $parent_out, $child_in; | |
| pipe $child_out, $parent_in; |
See also perlipc - Perl のプロセス間通信 (シグナル, fifo, パイプ, 安全な副プロセス, ソケット, セマフォ) 【perldoc.jp】
system "$CMD";
open $in, "| $CMD";
print $in "hoge";
close $in;
| mysql> select * from microsec limit 10; | |
| +------------+--------+ | |
| | epoch | us | | |
| +------------+--------+ | |
| | 1300337288 | 938208 | | |
| | 1300337288 | 965069 | | |
| | 1300337288 | 976498 | | |
| | 1300337288 | 987483 | | |
| | 1300337288 | 998476 | | |
| | 1300337289 | 9421 | |
| my $ret = $mysql->mysql("select count(*) from $TABLE", 'db' => $DB, 'opt' => "--skip-column-name"), | |
| note($ret); | |
| note explain $ret; | |
| is($ret, "200\n", "count"); | |
| note($ret); | |
| #--------------------------------------------------------------------------------------------------- | |
| # undef | |
| # 100 |
| use strict; | |
| use warnings; | |
| use Data::Dumper; | |
| use IO::Handle; | |
| my ($parent_in, $parent_out); | |
| my ($child_in, $child_out); | |
| pipe $parent_out, $child_in; | |
| pipe $child_out, $parent_in; | |
| $parent_in->autoflush(1); |
| use strict; | |
| use warnings; | |
| use IO::Handle; | |
| sub fork_exec { | |
| my @args = @_; | |
| my $handles = []; | |
| if (ref($args[$#args]) eq 'GLOB') { | |
| my $stdin = pop @args; |