Skip to content

Commit 4c836a4

Browse files
authored
Add example of feeding Proc's STDIN from a string
1 parent cd52c6b commit 4c836a4

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

doc/Type/Proc.pod6

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,16 @@ second command, you can do
2222
my $p2 = run 'cat', '-n', :in($p1.out), :out;
2323
say $p2.out.get;
2424
25+
You can also feed the `:in` pipe directly from your program, by setting it
26+
to `True`, which will make the pipe available via `.in` method on the C<Proc>:
27+
28+
my $p = run "cat", "-n", :in, :out;
29+
$p.in.say: "Hello,\nworld!";
30+
$p.in.close;
31+
say $p.out.slurp-rest;
32+
# OUTPUT:
33+
# 1 Hello,
34+
# 2 world!
2535
2636
=head1 Methods
2737

0 commit comments

Comments
 (0)