Skip to content

Commit 5bb9af9

Browse files
committed
AttributeContainer and Proc/Async now compile
1 parent 71caed5 commit 5bb9af9

File tree

2 files changed

+31
-19
lines changed

2 files changed

+31
-19
lines changed

doc/Type/Metamodel/AttributeContainer.pod6

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
=SUBTITLE Metaobject that can hold attributes
66
7-
role Metamodel::AttributeContainer { ... }
7+
role Metamodel::AttributeContainer {}
88
99
Classes, roles and grammars can have attributes. Storage and introspection of
1010
attributes is implemented by this role.
@@ -13,22 +13,22 @@ attributes is implemented by this role.
1313
1414
=head2 method add_attribute
1515
16-
method add_attribute(Metamodel::AttributeContainer: $obj, $name, $attribute)
16+
method add_attribute(Metamodel::AttributeContainer: $obj, $name, $attribute) {}
1717
1818
Adds an attribute. C<$attribute> must be an object that supports the
1919
methods C<name>, C<type> and C<package>, which are called without arguments.
2020
It can for example be of L<type Attribute|/type/Attribute>.
2121
2222
=head2 method attributes
2323
24-
method attributes(Metamodel::AttributeContainer: $obj)
24+
method attributes(Metamodel::AttributeContainer: $obj) {}
2525
2626
Returns a list of attributes. For most Perl 6 types, these will be objects of
2727
L<type Attribute|/type/Attribute>.
2828
2929
=head2 method set_rw
3030
31-
method set_rw(Metamodel::AttributeContainer: $obj)
31+
method set_rw(Metamodel::AttributeContainer: $obj) {}
3232
3333
Marks a type whose attributes default to having a write accessor. For example
3434
in
@@ -41,12 +41,14 @@ in
4141
The C<is rw> trait on the class calls the C<set_rw> method on the meta class,
4242
making all the attributes implicitly writable, so that you can write;
4343
44+
=begin code :skip-test
4445
my $p = Point.new(x => 1, y => 2);
4546
$p.x = 42;
47+
=end code
4648
4749
=head2 method rw
4850
49-
method rw(Metamodel::AttributeContainer: $obj)
51+
method rw(Metamodel::AttributeContainer: $obj) {}
5052
5153
Returns a true value if L<method set_rw|#method set_rw> has been called on
5254
this object, that is, if new public attributes are writable by default.

doc/Type/Proc/Async.pod6

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
55
=SUBTITLE Running process (asynchronous interface)
66
7-
class Proc::Async { ... }
7+
=begin code :skip-test
8+
class Proc::Async {}
9+
=end code
810
911
B<Note:> only the MoarVM backend of Rakudo implements C<Proc::Async> at the
1012
moment.
@@ -30,9 +32,11 @@ standard output and error handles, and optionally write to its standard input.
3032
3133
This produces the following output:
3234
35+
=begin code :skip-test
3336
Starting...
3437
Output: foo bar
3538
Done.
39+
=end code
3640
3741
An example that opens an external program for writing:
3842
@@ -47,7 +51,7 @@ An example that opens an external program for writing:
4751
4852
=head2 method new
4953
50-
method new(:$path, *@args, :$w) returns Proc::Async:D
54+
method new(:$path, *@args, :$w) returns Proc::Async:D {}
5155
5256
Creates a new C<Proc::Async> object with external program name or path C<$path>
5357
and the command line arguments C<@args>.
@@ -58,13 +62,14 @@ C<say>.
5862
5963
=head2 method stdout
6064
61-
method stdout(Proc::Async:D: :$bin) returns Supply:D
65+
method stdout(Proc::Async:D: :$bin) returns Supply:D {}
6266
6367
Returns the L<Supply|/type/Supply> for the external program's standard output
6468
stream. If C<:bin> is passed, the standard output is passed along in binary as
6569
L<Blob|/type/Blob>, otherwise it is interpreted as UTF-8, decoded, and passed
6670
along as L<Str|/type/Str>.
6771
72+
my $proc = Proc::Async.new(:r, 'echo', 'Perl 6');
6873
$proc.stdout.tap( -> $str {
6974
say "Got output '$str' from the external program";
7075
});
@@ -82,13 +87,14 @@ you try.
8287
8388
=head2 method stderr
8489
85-
method stderr(Proc::Async:D: :$bin) returns Supply:D
90+
method stderr(Proc::Async:D: :$bin) returns Supply:D {}
8691
8792
Returns the L<Supply|/type/Supply> for the external program's standard error
8893
stream. If C<:bin> is passed, the standard error is passed along in binary as
8994
L<Blob|/type/Blob>, otherwise it is interpreted as UTF-8, decoded, and passed
9095
along as L<Str|/type/Str>.
9196
97+
my $proc = Proc::Async.new(:r, 'echo', 'Perl 6');
9298
$proc.stderr.tap( -> $str {
9399
say "Got error '$str' from the external program";
94100
});
@@ -106,15 +112,15 @@ you try.
106112
107113
=head2 method w
108114
109-
method w(Proc::Async:D:)
115+
method w(Proc::Async:D:) {}
110116
111117
Returns a true value if C<:w> was passed to the constructor, that is, if the
112118
external program is started with its input stream made available to output to
113119
the program through the C<.print>, C<.say> and C<.write> methods.
114120
115121
=head2 method start
116122
117-
method start(Proc::Async:D:, :$scheduler = $*SCHEDULER, :$cwd = $*CWD) returns Promise:D
123+
method start(Proc::Async:D: :$scheduler = $*SCHEDULER, :$cwd = $*CWD) returns Promise:D {}
118124
119125
Initiates spawning of the external program. Returns a promise that will be
120126
kept with a L<Proc|/type/Proc> object once the external
@@ -127,38 +133,42 @@ thrown.
127133
128134
Note: If you wish to C<await> the Promise and discard its result, using
129135
136+
=begin code :skip-test
130137
try await $p.start;
138+
=end code
131139
132140
B<will throw> if the program exited with non-zero status, as the C<Proc>
133141
returned as the result of the Promise throws when sunk and in this case it
134142
will get sunk outside the C<try>. To avoid that, sink it yourself I<inside> the
135143
C<try>:
136144
145+
=begin code :skip-test
137146
try sink await $p.start;
147+
=end code
138148
139149
=head2 method started
140150
141-
method started(Proc::Async:D:) returns Bool:D
151+
method started(Proc::Async:D:) returns Bool:D {}
142152
143153
Returns C<False> before C<.start> has been called, and C<True> afterwards.
144154
145155
=head2 method path
146156
147-
method path(Proc::Async:D:)
157+
method path(Proc::Async:D:) {}
148158
149159
Returns the name and/or path of the external program that was passed to the
150160
C<new> method as first argument.
151161
152162
=head2 method args
153163
154-
method args(Proc::Async:D:) returns Positional:D
164+
method args(Proc::Async:D:) returns Positional:D {}
155165
156166
Returns the command line arguments for the external programs, as passed to the
157167
C<new> method.
158168
159169
=head2 method write
160170
161-
method write(Proc::Async:D: Blob:D $b, :$scheduler = $*SCHEDULER)
171+
method write(Proc::Async:D: Blob:D $b, :$scheduler = $*SCHEDULER) {}
162172
163173
Write the binary data in C<$b> to the standard input stream of the external
164174
program.
@@ -175,7 +185,7 @@ L<X::Proc::Async::MustBeStarted> exception is thrown.
175185
176186
=head2 method print
177187
178-
method print(Proc::Async:D: Str(Any) $str, :$scheduler = $*SCHEDULER)
188+
method print(Proc::Async:D: Str(Any) $str, :$scheduler = $*SCHEDULER) {}
179189
180190
Write the text data in C<$str> to the standard input stream of the external
181191
program, encoding it as UTF-8.
@@ -192,7 +202,7 @@ L<X::Proc::Async::MustBeStarted> exception is thrown.
192202
193203
=head2 method say
194204
195-
method say(Proc::Async:D: $output, :$scheduler = $*SCHEDULER)
205+
method say(Proc::Async:D: $output, :$scheduler = $*SCHEDULER) {}
196206
197207
Calls method C<gist> on the C<$output>, adds a newline, encodes it as UTF-8,
198208
and sends it to the standard input stream of the external
@@ -210,7 +220,7 @@ L<X::Proc::Async::MustBeStarted> exception is thrown.
210220
211221
=head2 method close-stdin
212222
213-
method close-stdin(Proc::Async:D:)
223+
method close-stdin(Proc::Async:D:) {}
214224
215225
Closes the standard input stream of the external program. Programs that read
216226
from STDIN often only terminate when their input stream is closed. So if
@@ -226,7 +236,7 @@ L<X::Proc::Async::MustBeStarted> exception is thrown.
226236
227237
=head2 method kill
228238
229-
kill(Proc::Async:D: $signal = "HUP")
239+
method kill(Proc::Async:D: $signal = "HUP") {}
230240
231241
Sends a signal to the running program. The signal can be a signal name
232242
("KILL" or "SIGKILL"), an integer (9) or an element of the C<Signal> enum

0 commit comments

Comments
 (0)