Skip to content

Commit ec374a6

Browse files
authored
Merge pull request #2955 from uzluisf/doc-proofreading
Proofread some documents
2 parents e2effd7 + cab2667 commit ec374a6

File tree

7 files changed

+164
-151
lines changed

7 files changed

+164
-151
lines changed

doc/Language/create-cli.pod6

Lines changed: 42 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -12,47 +12,48 @@ The default command line interface of Perl 6 scripts consists of three parts:
1212
=head2 Parsing the command line parameters into a L<capture|/type/Capture>
1313
1414
This looks at the values in L<@*ARGS|/language/variables#index-entry-@*ARGS>,
15-
interprets these according to some policy, and creates a C<Capture> object
16-
out of that. An alternative way of parsing may be provided by the developer
15+
interprets these according to some policy, and creates a L<Capture/type/Capture>
16+
object out of that. An alternative way of parsing may be provided by the developer
1717
or installed using a module.
1818
1919
=head2 Calling a provided C<MAIN> subroutine using that capture
2020
2121
Standard L<multi dispatch|/language/functions#index-entry-declarator_multi-Multi-dispatch>
22-
is used to call the MAIN subroutine with the generated C<Capture> object.
23-
This means that your MAIN subroutine may be a C<multi sub>, each candidate
22+
is used to call the C<MAIN> subroutine with the generated C<Capture> object.
23+
This means that your C<MAIN> subroutine may be a C<multi sub>, each candidate
2424
of which is responsible for some part of processing the given command line
2525
arguments.
2626
2727
=head2 Creating / showing usage information if calling C<MAIN> failed
2828
2929
If multi dispatch failed, then the user of the script should be informed as
30-
well as possible as to why it failed. By default, this is done by inspecting
31-
the signature of each MAIN candidate sub, and any associated pod information.
30+
well as possible as to why it failed. By default, this is done by inspecting
31+
the signature of each C<MAIN> candidate sub, and any associated Pod information.
3232
The result is then shown to the user on STDERR (or on STDOUT if C<--help>
33-
was specified). An alternative way of generating the usage information may
33+
was specified). An alternative way of generating the usage information may
3434
be provided by the developer or installed using a module.
3535
3636
X<|MAIN>
3737
=head1 sub MAIN
3838
3939
The sub with the special name C<MAIN> will be executed after all relevant entry
4040
phasers (C<BEGIN>, C<CHECK>, C<INIT>, C<PRE>, C<ENTER>) have been run and
41-
the mainline of the script has been executed. No error will occur if there
42-
is no MAIN sub: your script will then just have to do the work, such as
43-
argument parsing, in the mainline of the script.
44-
45-
Any normal exit from the MAIN sub will result in an exit code of C<0>,
46-
indicating success. Any return value of the MAIN sub will be ignored.
47-
If an exception is thrown that is not handled inside the MAIN sub, then the
48-
exit code will be C<1>. If the dispatch to MAIN failed, a usage message
41+
the L<mainline|/language/glossary#index-entry-Mainline> of the script has been
42+
executed. No error will occur if there is no C<MAIN> sub: your script will
43+
then just have to do the work, such as argument parsing, in the mainline of
44+
the script.
45+
46+
Any normal exit from the C<MAIN> sub will result in an exit code of C<0>,
47+
indicating success. Any return value of the C<MAIN> sub will be ignored.
48+
If an exception is thrown that is not handled inside the C<MAIN> sub, then the
49+
exit code will be C<1>. If the dispatch to C<MAIN> failed, a usage message
4950
will be displayed on STDERR and the exit code will be C<2>.
5051
5152
The command line parameters are present in the C<@*ARGS> dynamic variable
5253
and may be altered in the mainline of the script before the C<MAIN> unit is
5354
called.
5455
55-
The signature of (the candidates of the multi) sub MAIN determines which
56+
The signature of (the candidates of the multi) sub C<MAIN> determines which
5657
candidate will actually be called using the standard
5758
L<multi dispatch|/language/glossary#index-entry-Multi-Dispatch> semantics.
5859
@@ -63,7 +64,8 @@ A simple example:
6364
say "Hello $name, how are you?"
6465
}
6566
66-
If you call that script without any parameters:
67+
If you call that script without any parameters, you get the following
68+
usage message:
6769
6870
=begin code :lang<shell>
6971
$ perl6 hello.p6
@@ -95,10 +97,10 @@ Another way to do this is to make C<sub MAIN> a C<multi sub>:
9597
multi sub MAIN() { say "Hello bashful, how are you?" }
9698
multi sub MAIN($name) { say "Hello $name, how are you?" }
9799
98-
Which would give the same output as the examples above. Whether you should
100+
Which would give the same output as the examples above. Whether you should
99101
use either method to achieve the desired goal is entirely up to you.
100102
101-
A more complicated example using a single positional and multiple
103+
A more complicated example using a single positional and multiple
102104
named parameters:
103105
104106
=for code :method<False>
@@ -141,7 +143,7 @@ Usage:
141143
=end code
142144
143145
Although you don't have to do anything in your code to do this, it may still
144-
be regarded as a bit terse. But there's an easy way to make that usage
146+
be regarded as a bit terse. But there's an easy way to make that usage
145147
message better by providing hints using pod features:
146148
147149
=for code :method<False>
@@ -197,7 +199,7 @@ X<|%*SUB-MAIN-OPTS>
197199
=head2 %*SUB-MAIN-OPTS
198200
199201
It's possible to alter how arguments are processed before they're passed
200-
to C<sub MAIN {}> by setting options in the C<%*SUB-MAIN-OPTS> hash. Due to
202+
to C<sub MAIN {}> by setting options in the C<%*SUB-MAIN-OPTS> hash. Due to
201203
the nature of dynamic variables, it is required to set up the
202204
C<%*SUB-MAIN-OPTS> hash and fill it with the appropriate settings.
203205
For instance:
@@ -216,7 +218,7 @@ X<|named-anywhere>
216218
=head3 named-anywhere
217219
218220
By default, named arguments passed to the program (i.e., C<MAIN>)
219-
cannot appear after any positional argument. However, if
221+
cannot appear after any positional argument. However, if
220222
C«%*SUB-MAIN-OPTS<named-anywhere>» is set to a true value, named arguments
221223
can be specified anywhere, even after positional parameter. For example,
222224
the above program can be called with:
@@ -229,9 +231,9 @@ X<|hidden-from-USAGE>
229231
=head2 is hidden-from-USAGE
230232
231233
Sometimes you want to exclude a C<MAIN> candidate from being shown in any
232-
automatically generated usage message. This can be achieved by adding
233-
a C<hidden-from-USAGE> trait to the specification of the MAIN candidate
234-
you do not want to show. Expanding on an earlier example:
234+
automatically generated usage message. This can be achieved by adding
235+
a C<hidden-from-USAGE> trait to the specification of the C<MAIN> candidate
236+
you do not want to show. Expanding on an earlier example:
235237
236238
# inside file 'hello.p6'
237239
multi sub MAIN() is hidden-from-USAGE {
@@ -323,10 +325,10 @@ X<|ARGS-TO-CAPTURE>
323325
The C<ARGS-TO-CAPTURE> subroutine should accept two parameters: a
324326
L<Callable|/type/Callable> representing the C<MAIN> unit to be executed (so it
325327
can be introspected if necessary) and an array with the arguments from the
326-
command line. It should return a L<Capture|/type/Capture> object that will be
327-
used to dispatch the C<MAIN> unit. A B<very> contrived example that will create
328-
a C<Capture> depending on some keyword that was entered (which can be handy
329-
during testing of a command line interface of a script):
328+
command line. It should return a L<Capture|/type/Capture> object that will be
329+
used to dispatch the C<MAIN> unit. The following is a B<very> contrived example
330+
that will create a C<Capture> depending on some keyword that was entered (which
331+
can be handy during testing of a command line interface of a script):
330332
331333
sub ARGS-TO-CAPTURE(&main, @args --> Capture) {
332334
# if we only specified "frobnicate" as an argument
@@ -357,14 +359,14 @@ Defined as:
357359
358360
sub RUN-MAIN(&main, $mainline, :$in-as-argsfiles)
359361
360-
This routine allows complete control over the handling of C<MAIN>. It gets a
361-
C<Callable> that is the MAIN that should be executed, the return value of the
362-
mainline execution and additional named variables: C<:in-as-argsfiles> which
362+
This routine allows complete control over the handling of C<MAIN>. It gets a
363+
C<Callable> that is the C<MAIN> that should be executed, the return value of the
364+
mainline execution and additional named variables: C<:in-as-argsfiles> which
363365
will be C<True> if STDIN should be treated as C<$*ARGFILES>.
364366
365367
If C<RUN-MAIN> is not provided, a default one will be run that looks for
366-
subroutines of the old interface, such as C<MAIN_HELPER> and C<USAGE>. If
367-
found, will execute following the "old" semantics.
368+
subroutines of the old interface, such as C<MAIN_HELPER> and C<USAGE>. If
369+
found, it will execute following the "old" semantics.
368370
369371
=begin code
370372
class Hero {
@@ -391,9 +393,9 @@ X<|GENERATE-USAGE>
391393
392394
The C<GENERATE-USAGE> subroutine should accept a C<Callable> representing the
393395
C<MAIN> subroutine that didn't get executed because the dispatch failed.
394-
This can be used for introspection. All the other parameters are the
395-
parameters that were set up to be sent to C<MAIN>. It should return the
396-
string of the usage information you want to be shown to the user. An example
396+
This can be used for introspection. All the other parameters are the
397+
parameters that were set up to be sent to C<MAIN>. It should return the
398+
string of the usage information you want to be shown to the user. An example
397399
that will just recreate the C<Capture> that was created from processing the
398400
arguments:
399401
@@ -423,13 +425,13 @@ An older interface enabled one to intercept the calling to C<MAIN> completely.
423425
This depended on the existence of a C<MAIN_HELPER> subroutine that would be
424426
called if a C<MAIN> subroutine was found in the mainline of a program.
425427
426-
This interface was never documented. However, any programs using this
427-
undocumented interface will continue to function until C<v6.e>. From v6.d
428+
This interface was never documented. However, any programs using this
429+
undocumented interface will continue to function until C<v6.e>. From v6.d
428430
onward, the use of the undocumented API will cause a C<DEPRECATED> message.
429431
430432
Ecosystem modules can provide both the new and the old interface for
431433
compatibility with older versions of Perl 6: if a newer Perl 6 recognizes
432-
the new (documented) interface, it will use that. If there is no new
434+
the new (documented) interface, it will use that. If there is no new
433435
interface subroutine available, but the old C<MAIN_HELPER> interface is,
434436
then it will use the old interface.
435437

doc/Language/exceptions.pod6

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
Exceptions in Perl 6 are objects that hold information about errors. An
88
error can be, for example, the unexpected receiving of data or a network
99
connection no longer available, or a missing file. The information that
10-
an exception objects store is, for instance, a human-readable message
10+
an exception object stores is, for instance, a human-readable message
1111
about the error condition, the backtrace of the raising of the error,
1212
and so on.
1313
@@ -33,8 +33,8 @@ Typed exceptions provide more information about the error stored
3333
within an exception object.
3434
3535
For example, if while executing C<.zombie copy> on an object, a needed path
36-
C<foo/bar> becomes unavailable, then an L<X::IO::DoesNotExist|/type/X::IO::DoesNotExist> exception can be
37-
raised:
36+
C<foo/bar> becomes unavailable, then an
37+
L<X::IO::DoesNotExist|/type/X::IO::DoesNotExist> exception can be raised:
3838
3939
die X::IO::DoesNotExist.new(:path("foo/bar"), :trying("zombie copy"))
4040
@@ -376,7 +376,7 @@ printing a backtrace along with the message:
376376
377377
class X::WithoutLineNumber is X::AdHoc {
378378
multi method gist(X::WithoutLineNumber:D:) {
379-
$.payload
379+
$.payload
380380
}
381381
}
382382
die X::WithoutLineNumber.new(payload => "message")

doc/Language/experimental.pod6

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
=SUBTITLE Preview of upcoming new language features available for user evaluation
66
77
During Perl 6 development, new features are often made available for
8-
users to experimental with before their design is completed. Eventually
9-
these features may be made part of the Perl 6 specification. To use these
8+
users as experimental before their design is completed. Eventually
9+
these features may be made part of the Perl 6 specification. To use these
1010
features, one uses the C<experimental> pragma in program source code, for
1111
example, like this:
1212
@@ -19,9 +19,8 @@ These are the features that, for the time being, are experimental.
1919
Pack is a feature that allows binary serialization of general data structures,
2020
and is inherited from
2121
L<Perl's pack|http://perldoc.perl.org/functions/pack.html>.
22-
The C<pack> order creates a
23-
C<Buf> by packing data structures in a certain way given by a I<packing string>
24-
with the options shown
22+
The C<pack> order creates a C<Buf> by packing data structures in a certain
23+
way given by a I<packing string> with the options shown
2524
L<in the description of C<unpack>|/type/Blob#method_unpack>. You turn it on by
2625
inserting this pragma at the beginning of your program:
2726
@@ -120,8 +119,8 @@ it would be best to keep them away from production code. Meanwhile, taking a
120119
look at
121120
L<this article by Masak|https://perl6advent.wordpress.com/2012/12/23/day-23-macros/>
122121
as well as
123-
L<C<007>|https://github.com/masak/007>, a new macro language, which might show
124-
the shape of things to come.
122+
L<C<007>|https://github.com/masak/007>, a new macro language, might provide
123+
a glimpse into the things to come.
125124
126125
=head2 X<B<cached>|:cached>
127126

0 commit comments

Comments
 (0)