Permalink
Browse files

Applied edits from Gabrielle Roth.

  • Loading branch information...
1 parent 82485da commit 04471ecc2c7af1734269219702a936b21ab100af @chromatic committed Sep 16, 2010
View
@@ -161,3 +161,6 @@ E: matthias.bloch@puffin.ch
N: Larry Wall
E: larry@wall.org
+
+N: Gabrielle Roth
+E: gorthx@gmail.com>
View
@@ -6,8 +6,8 @@ Perl uses sigils and other punctuation pervasively to help both the parser and
the programmer identify the categories of named entities. Even so, Perl is a
malleable language. You can write programs in the most creative, maintainable,
obfuscated, or bizarre fashion as you prefer. Maintainability is a concern of
-good programs, but the developers of Perl itself don't presume to dictate what
-I<you> find most maintainable.
+good programmers, but the developers of Perl itself don't presume to dictate
+what I<you> find most maintainable.
X<bareword>
@@ -180,10 +180,10 @@ the function to use for sorting to avoid the use of barewords:
The result is one line longer, but it avoids the use of a bareword. Unlike
other bareword examples, Perl's parser needs no disambiguation for this syntax.
-There is only one way for it to interpret C<compare_lengths>. Even so, the
+There is only one way for it to interpret C<compare_lengths>. However, the
clarity of an explicit reference can help human readers.
-Even so, Perl 5's parser does not understand the single-line version:
+Note that Perl 5's parser does not understand the single-line version:
=begin programlisting
View
@@ -2,7 +2,7 @@
Perl turns 23 years old later this year. The language has gone from a simple
tool for system administration somewhere between shell scripting and C
-programming (Perl 1) to a powerful, general purpose language steeped in a rich
+programming (Perl 1) to a powerful, general-purpose language steeped in a rich
heritage (Perl 5) and a consistent, coherent, rethinking of programming in
general intended to last for another 25 years (Perl 6).
View
@@ -16,7 +16,7 @@ them.
Fortunately, the Perl community exists. It's strong and healthy. It welcomes
willing participants at all levels--and not just for people who produce and
share code. Consider taking advantage of the knowledge and experience of
-countless other Perl programmers, and to share your abilities as well.
+countless other Perl programmers, and sharing your abilities as well.
L<perl_community>
@@ -15,8 +15,8 @@ remainder of the sentence.
Context in Perl is similar; the language understands expectations of the amount
of data to provide as well as what kind of data to provide. Perl will happily
-attempt to provide exactly what you ask for--and you do this asking when you
-choose one operator over another.
+attempt to provide exactly what you ask for--and you ask by choosing one
+operator over another.
One type of context in Perl means that certain operators have different
behavior if you want zero, one, or many results. It's possible that a specific
@@ -76,7 +76,7 @@ function in I<scalar context>:
X<list context>
Assigning the results of calling the function to an array (L<arrays>) or a
-list, or using it in a list evaluates the function in I<list context>:
+list, or using it in a list, evaluates the function in I<list context>:
=begin programlisting
@@ -129,8 +129,8 @@ contain. Both calls to C<some_expensive_operation()> occur in list context:
=end programlisting
-C<expensive_operation> above is in list context, because it's being assigned to
-a hash, and hash assignments take a list of key/value pairs, which causes any
+C<expensive_operation> is in list context, because it's assigned to a
+hash, and hash assignments take a list of key/value pairs, which causes any
expressions in that hash assignment to be evaulated in list context.
X<operators; scalar>
@@ -3,10 +3,10 @@
Z<implicit_ideas>
Like many spoken languages, Perl provides linguistic shortcuts. Context is one
-such feature. Both the compiler and a programmer reading the code can
+such feature: both the compiler and a programmer reading the code can
understand the expected number of results or the type of an operation from
-existing information without adding explicit additional information to
-disambiguate. Others also exist.
+existing information without requiring additional information to disambiguate.
+Others also exist.
=head2 The Default Scalar Variable
@@ -18,7 +18,7 @@ X<$_>
The I<default scalar variable> (also called the I<topic variable>), C<$_>, is
the best example of a linguistic shortcut in Perl. It's most notable in its
-I<absence>: many of Perl's built in operations perform their work on the
+I<absence>: many of Perl's builtin operations perform their work on the
contents of C<$_> in the absence of an explicit variable. You can still use
C<$_> as the variable, but it's often unnecessary.
@@ -83,9 +83,9 @@ X<keywords; reverse>
X<uc>
X<keywords; uc>
-Many of Perl's scalar operators (including but not limited to C<chr>, C<ord>,
-C<lc>, C<length>, C<reverse>, and C<uc>) work on the default scalar variable if
-you do not provide an alternative.
+Many of Perl's scalar operators (including C<chr>, C<ord>, C<lc>, C<length>,
+C<reverse>, and C<uc>) work on the default scalar variable if you do not
+provide an alternative.
Perl's looping directives (L<looping_directives>) also set C<$_>, such as
C<for> iterating over a list:
@@ -58,7 +58,7 @@ package names the parser has seen at the current point in the parse, which
barewords it has already resolved (and how it resolved them), and the I<names>
of functions already declared in the current package.
-Imagine running afoul of a function with (prototypes) L<prototypes> with a
+Imagine running afoul of a prototyped function (L<prototypes>) with a
name which just happens to conflict somehow with the name of a class or a
method called indirectly. This is infrequent, but so difficult to debug that
avoiding this syntax is always worthwhile.
@@ -13,7 +13,7 @@ appropriate package as a method if you try to call it as a method.
Likewise, you can invoke a method as if it were a function--fully-qualified,
exported, or as a reference--if you pass in your own invocant manually.
-Both have their problems; avoid them.
+Both approaches have their problems; avoid them.
=head2 Caller-side
@@ -106,8 +106,8 @@ does when invoking a method with a scalar containing its name:
=end programlisting
There is one small drawback in invoking a method by reference; if the structure
-of the program has changed in between storing the reference and invoking the
-reference, the reference may no longer refer to the current most appropriate
+of the program has changed between storing the reference and invoking the
+reference, the reference may no longer refer to the current, most appropriate
method. If the C<Order> class has changed such that C<Order::apply_discount>
is no longer the right method to call, the reference in C<$meth_ref> will not
have updated.
@@ -26,7 +26,7 @@ variable declarations, and forbidding the use of undeclared barewords
to perform symbol-table manipulation and exporting (barring the use of helper
modules, such as C<Moose>), the use of a variable as a variable name offers the
possibility of subtle errors of action at a distance--or, worse, the
-possibility of poorly validated user input manipulating internal-only data for
+possibility of poorly-validated user input manipulating internal-only data for
malicious purposes.
Requiring variable declarations helps to prevent typos in variable names and
@@ -33,7 +33,7 @@ X<PerlMonks>
PerlMonks, at U<http://perlmonks.org/>, is a venerable community site devoted
to questions and answers and other discussions about Perl programming. It
-celebrated its tenth anniversary in December 2009, making it one of the longest
+celebrated its tenth anniversary in December 2009, making it one of the longest-
lasting web communities dedicated to any programming language.
X<use Perl;>
@@ -50,7 +50,7 @@ Other sites aggregate the Perl-related musings of Perl hackers, including
U<http://perlsphere.net/>, U<http://planet.perl.org/>, and
U<http://ironman.enlightenedperl.org/>. The latter is part of an initiative
from the Enlightened Perl Organization (U<http://enlightenedperl.org/>) to
-increase the amount of and improve the quality of Perl publishing on the web.
+increase the amount and improve the quality of Perl publishing on the web.
X<Perl Buzz>
@@ -87,7 +87,7 @@ X<Gitpan>
Many Perl hackers use Github (U<http://github.com/>) to host their
projectsN<... including the drafts of this book at
-U<http://github.com/chromatic/modern_perl_book/>)>. One particularly notable
+U<http://github.com/chromatic/modern_perl_book/>>. One particularly notable
page on Github is Gitpan, which hosts Git repositories chronicling the complete
history of every distribution on the CPAN. See U<http://github.com/gitpan/>.
View
@@ -39,7 +39,7 @@ pragma with funny syntax. Pragma scope is clearer with an example:
=begin sidebar
-A sufficiently motivated Perl guru could implement a poorly behaved pragma
+A sufficiently motivated Perl guru could implement a poorly-behaved pragma
which ignores scoping, but that would be unneighborly.
=end sidebar
View
@@ -6,9 +6,9 @@ X<prototypes>
A I<prototype> is a piece of optional metadata attached to a function
declaration. Novices commonly assume that these prototypes serve as function
-signatures. They do not; instead they serve two separate purposes. They offer
-hints to the parser to change the way it parses functions and their arguments.
-They also modify the way Perl 5 handles arguments to those functions.
+signatures; they do not. Instead they serve two separate purposes: they offer
+hints to the parser to change the way it parses functions and their arguments,
+and they modify the way Perl 5 handles arguments to those functions.
To declare a function prototype, add it after the name:

0 comments on commit 04471ec

Please sign in to comment.