Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Document a bit more of Proc::Aync, related exceptions
- Loading branch information
Showing
3 changed files
with
87 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| =begin pod | ||
| =TITLE class X::Proc::Async::MustBeStarted | ||
| =SUBTITLE Exception class for L<Proc::Async> methods that must be called after the program has been spawned | ||
| class X::Proc::Async::MustBeStarted is Exception { ... } | ||
| Several methods from L<Proc::Async> excpect that the external program has been | ||
| spawned (by calling C<.start> on it), including C<say>, C<write>, C<print> and | ||
| C<close-stdin>. If one of those methods is called before C<.start> was called, | ||
| they throw an exception of type C<X::Proc::Async::MustBeStarted>. | ||
| Proc::Async.new('echo', :w).say(42); | ||
| # dies with Process must be started first before calling 'say' | ||
| =head1 Methods | ||
| =head2 method method | ||
| method method(X::Proc::Async::MustBeStarted:D) returns Str:D | ||
| Returns the name of the method that was illegally called before starting the | ||
| external program. | ||
| =end pod |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| =begin pod | ||
| =TITLE class X::Proc::Async::OpenForWriting | ||
| =SUBTITLE Exception class for write operations on a L<Proc::Async> object opened for reading | ||
| class X::Proc::Async::OpenForWriting is Exception { ... } | ||
| When a L<Proc::Async> object is opened only for reading from the external | ||
| program (no C<:w> passed to open), and a write operation such as C<write>, | ||
| C<print> and C<say> is performed, an exception of type | ||
| X<X::Proc::Async::OpenForWriting> is thrown: | ||
| my $proc = Proc::Async.new("echo"); | ||
| $proc.start; | ||
| $proc.say(42) # Process must be opened for writing with :w to call 'say' | ||
| =head1 Methods | ||
| =head2 method method | ||
| method method(X::Proc::Async::OpenForWriting:D:) | ||
| Returns the method name that was called and which caused the exception. | ||
| =end pod |