From 8f2bc4df555ad5d7b49cbf9733d99820f809dda5 Mon Sep 17 00:00:00 2001 From: pdcamilleri Date: Tue, 1 Nov 2011 20:46:33 +1100 Subject: [PATCH 01/40] Simple typo: "here's" instead of "there's". --- sections/perldoc.pod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sections/perldoc.pod b/sections/perldoc.pod index e67c7a5c..32fbcdd9 100644 --- a/sections/perldoc.pod +++ b/sections/perldoc.pod @@ -39,7 +39,7 @@ The first example displays the documentation embedded within the C module. The second example displays a pure documentation file, in this case the table of contents of the core documentation. The third example displays a pure documentation file included as part of a CPAN distribution (L). -C hides these details; here's no distinction between reading the +C hides these details; there's no distinction between reading the documentation for a core library such as C or one installed from the CPAN. From 20d6500778db9323768c7a15120f0e21a5fba17c Mon Sep 17 00:00:00 2001 From: pdcamilleri Date: Tue, 1 Nov 2011 20:49:18 +1100 Subject: [PATCH 02/40] Simple type: "leaning" instead of "learning", although the former still makes sense in an abstract way. --- sections/expressivity.pod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sections/expressivity.pod b/sections/expressivity.pod index 77d17906..d96e61d6 100644 --- a/sections/expressivity.pod +++ b/sections/expressivity.pod @@ -64,7 +64,7 @@ X Perl's expressivity also allows novices to write useful programs without having to understand everything. The resulting code is often called I, in the sense that most everyone wants to help babies learn to communicate well. -Everyone begins as a novice. Through practice and leaning from more experienced +Everyone begins as a novice. Through practice and learning from more experienced programmers, you will understand and adopt more powerful idioms and techniques. For example, a Perl novice might triple a list of numbers by writing: From e2192d4a33901fc477f46375abc81cef73d5da2b Mon Sep 17 00:00:00 2001 From: pdcamilleri Date: Tue, 1 Nov 2011 21:10:05 +1100 Subject: [PATCH 03/40] Added reference to 'perldoc -f chomp' since looking up $/ alone may not show the student the relationship between chomp and $/. --- sections/implicit_ideas.pod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sections/implicit_ideas.pod b/sections/implicit_ideas.pod index 6406e92b..ee088494 100644 --- a/sections/implicit_ideas.pod +++ b/sections/implicit_ideas.pod @@ -24,7 +24,7 @@ C<$_> as the variable, but it's often unnecessary. X> For example, the C builtin removes any trailing newline sequence from -the given stringN for more precise details of its behavior.>: +the given stringN and C<$/> for more precise details of its behavior.>: =begin programlisting From 3fd07bd33d869c44b2fe088c1a9cdaacf0f16bc3 Mon Sep 17 00:00:00 2001 From: Mark Hindess Date: Tue, 1 Nov 2011 16:41:15 +0000 Subject: [PATCH 04/40] Make #! consistent with other instances in book. --- sections/autoload.pod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sections/autoload.pod b/sections/autoload.pod index cfa5cb07..6ab18fa1 100644 --- a/sections/autoload.pod +++ b/sections/autoload.pod @@ -8,7 +8,7 @@ program: =begin programlisting - #! perl + #!/usr/bin/perl use Modern::Perl; From 88af58e03b2df9425211028ea150fb364460976c Mon Sep 17 00:00:00 2001 From: Mark Hindess Date: Tue, 1 Nov 2011 16:42:10 +0000 Subject: [PATCH 05/40] Missing space. --- sections/hashes.pod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sections/hashes.pod b/sections/hashes.pod index 9bffb4cb..c2939a1f 100644 --- a/sections/hashes.pod +++ b/sections/hashes.pod @@ -621,7 +621,7 @@ To prevent someone from accidentally adding a hash key you did not intend (whether as a typo or from untrusted user input), use the C function to restrict the hash to its current set of keys. Any attempt to add a new key to the hash will raise an exception. This is lax security suitable only -for preventing accidents; anyone can use theC function to remove +for preventing accidents; anyone can use the C function to remove this protection. Similarly you can lock or unlock the existing value for a given key in the hash From 8da374c51598c7cbb94d7749a6d4a71bf118134d Mon Sep 17 00:00:00 2001 From: Mark Hindess Date: Tue, 1 Nov 2011 16:42:55 +0000 Subject: [PATCH 06/40] Typo: pash => pass. --- sections/references.pod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sections/references.pod b/sections/references.pod index 9b1e443b..7cb15ed6 100644 --- a/sections/references.pod +++ b/sections/references.pod @@ -28,7 +28,7 @@ Consider the alternative. If you had to make copies of every value before anything could possibly change them out from under you, you'd have to write lots of extra defensive code. -Yet sometimes it's useful to modify values in place. If you want to pash a hash +Yet sometimes it's useful to modify values in place. If you want to pass a hash full of data to a function to modify, creating and returning a new hash for each change could be troublesome (to say nothing of inefficient). From a4a077bd2223aa16ed73f3bc19dbe73fa4c7e4d5 Mon Sep 17 00:00:00 2001 From: Mark Hindess Date: Tue, 1 Nov 2011 16:44:25 +0000 Subject: [PATCH 07/40] Incorrect pod blocks for programlisting should be screen. --- sections/cpan.pod | 16 ++++++++-------- sections/handling_warnings.pod | 4 ++-- sections/prototypes.pod | 12 ++++++------ sections/testing.pod | 4 ++-- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/sections/cpan.pod b/sections/cpan.pod index 4c28a6e7..a0e4e49e 100644 --- a/sections/cpan.pod +++ b/sections/cpan.pod @@ -76,19 +76,19 @@ This book recommends the use of CPAN.pm solely due to its ubiquity. With a recent version (as of this writing, 1.9800 is the latest stable release), module installation is reasonably easy. Start the client with: -=begin programlisting +=begin screen $ B -=end programlisting +=end screen To install a distribution: -=begin programlisting +=begin screen $ B -=end programlisting +=end screen X> @@ -118,25 +118,25 @@ projects help to make this possible. C is a relatively new CPAN client with goals of speed, simplicity, and zero configuration. Install it with C, or: -=begin programlisting +=begin screen $ B $ B -=end programlisting +=end screen C is a system to manage and to switch between your own installations of multiple versions and configurations of Perl. Installation is as easy as: -=begin programlisting +=begin screen $ B $ B $ B<./perlbrew install> $ B -=end programlisting +=end screen X X diff --git a/sections/handling_warnings.pod b/sections/handling_warnings.pod index 131daf48..6157e14f 100644 --- a/sections/handling_warnings.pod +++ b/sections/handling_warnings.pod @@ -57,11 +57,11 @@ X; verbose> C's verbose mode adds backtraces to all warnings produced by C and C (L) throughout the entire program: -=begin programlisting +=begin screen $ perl -MCarp=verbose my_prog.pl -=end programlisting +=end screen Use C when writing modules (L) instead of C or C. diff --git a/sections/prototypes.pod b/sections/prototypes.pod index aced3665..ff74d985 100644 --- a/sections/prototypes.pod +++ b/sections/prototypes.pod @@ -38,7 +38,7 @@ The builtin C takes the name of a function and returns a string representing its prototype. Use the C form to see the prototype of a builtin: -=begin programlisting +=begin screen $ B \@@ @@ -47,12 +47,12 @@ builtin: $ B *;$@ -=end programlisting +=end screen C will return C for those builtins whose functions you cannot emulate: -=begin programlisting +=begin screen $ B undef @@ -62,16 +62,16 @@ emulate: undef # Builtin function C has no prototype. -=end programlisting +=end screen Remember C? -=begin programlisting +=begin screen $ B \@@ -=end programlisting +=end screen The C<@> character represents a list. The backslash forces the use of a I to the corresponding argument. This prototype means that C diff --git a/sections/testing.pod b/sections/testing.pod index 39171153..2f14f13b 100644 --- a/sections/testing.pod +++ b/sections/testing.pod @@ -116,7 +116,7 @@ that everything passed or the specifics of any failures. The core module C interprets TAP, and its related program C runs tests and displays only the most pertinent information: -=begin programlisting +=begin screen $ B truth_values.t .. 1/? @@ -134,7 +134,7 @@ and displays only the most pertinent information: truth_values.t (Wstat: 512 Tests: 4 Failed: 2) Failed tests: 2-3 -=end programlisting +=end screen That's a lot of output to display what is already obvious: the second and third tests fail because zero and the empty string evaluate to false. It's easy to From d105c191f2b72aafe75ba1955917d67d94b0f820 Mon Sep 17 00:00:00 2001 From: thundergnat Date: Tue, 1 Nov 2011 11:31:45 -0300 Subject: [PATCH 08/40] I think you some words out. --- sections/context_philosophy.pod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sections/context_philosophy.pod b/sections/context_philosophy.pod index 6ba7eb23..7d1048d9 100644 --- a/sections/context_philosophy.pod +++ b/sections/context_philosophy.pod @@ -162,7 +162,7 @@ data. You've probably already noticed that Perl's flexible about figuring out if you have a number or a string and converting between the two as you want them. In exchange for not having to declare (or at least track) explicitly what I of data a variable contains or a function produces, Perl's type -contexts that tell the compiler how to treat data. +contexts provide hints that tell the compiler how to treat data. X> From 56aaed4e4c6d535a64ca0bcd25b2d98176206bc5 Mon Sep 17 00:00:00 2001 From: thundergnat Date: Tue, 1 Nov 2011 12:46:12 -0300 Subject: [PATCH 09/40] Add some verbiage about destructive array updates in a while loop --- sections/control_flow.pod | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/sections/control_flow.pod b/sections/control_flow.pod index f4c04b64..9ff6270c 100644 --- a/sections/control_flow.pod +++ b/sections/control_flow.pod @@ -708,6 +708,23 @@ X To prevent such an infinite C loop, use a I of the C<@values> array by modifying the array with each loop iteration: +=begin programlisting + + while (@values) + { + my $value = shift @values; + say $value; + } + +=end programlisting + +=begin sidebar + +You might also write a C loop that does the I of +the C<@values> array inside the C condition check. This is a common +and idiomatic construct, but has some subtleties that aren't immediately +obvious to beginners. + =begin programlisting while (my $value = shift @values) @@ -717,6 +734,12 @@ C<@values> array by modifying the array with each loop iteration: =end programlisting +This loop will exit as soon as it reaches an element that evaluates to a +false or undefined value, not necessarily when it has exhausted the array. +That may be the desired behavior, but is often surprising to novices. + +=end sidebar + X> The I loop reverses the sense of the test of the C loop. From dea972d314b964986851b15a89c7d6282f6a64a9 Mon Sep 17 00:00:00 2001 From: thundergnat Date: Tue, 1 Nov 2011 14:37:15 -0300 Subject: [PATCH 10/40] spurious unclosed begin sidebar POD directive --- sections/closures.pod | 2 -- 1 file changed, 2 deletions(-) diff --git a/sections/closures.pod b/sections/closures.pod index b8a77825..4f4ca0d9 100644 --- a/sections/closures.pod +++ b/sections/closures.pod @@ -84,8 +84,6 @@ lexical environment: =end programlisting -=begin sidebar - Because C does not return these lexicals by value or by reference, no other Perl code besides the closure can access them. They're encapsulated as effectively as any other lexical encapsulation, although any From 041306bd25e9803519b2f59d3334d5bfe1539dfa Mon Sep 17 00:00:00 2001 From: thundergnat Date: Tue, 1 Nov 2011 15:02:51 -0300 Subject: [PATCH 11/40] remove spurious programlisting POD directives --- sections/blessed_references.pod | 4 ---- 1 file changed, 4 deletions(-) diff --git a/sections/blessed_references.pod b/sections/blessed_references.pod index d390c387..1ea3d09c 100644 --- a/sections/blessed_references.pod +++ b/sections/blessed_references.pod @@ -199,13 +199,9 @@ pragma, but C superseded C in Perl 5.10.>: =end programlisting -=begin programlisting - Moose has its own metamodel which stores extended inheritance information; this offers additional features. -=end programlisting - X X From cf47eebfc36f0ae6bf2b6fd77808fcbf061d2d7a Mon Sep 17 00:00:00 2001 From: thundergnat Date: Tue, 1 Nov 2011 15:46:19 -0300 Subject: [PATCH 12/40] Mention paragraph mode for $/ --- sections/globals.pod | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sections/globals.pod b/sections/globals.pod index a44ea9cb..59c5fc5c 100644 --- a/sections/globals.pod +++ b/sections/globals.pod @@ -123,7 +123,9 @@ reading input a line at a time. By default, this is your platform-specific newline character sequence. If you undefine this value, Perl will attempt to read the entire file into memory. If you set this value to a I to an integer, Perl will try to read that many I per record (so beware of -Unicode concerns). +Unicode concerns). If you set this value to an empty string: C<''>, the file +will be read in "paragraph" mode. (Chunks of text separated by an arbitrary +number of newlines.) X> X> From ca1e1bdfb61c19c06a6fd4eebd9377a0f26c00a5 Mon Sep 17 00:00:00 2001 From: chromatic Date: Wed, 2 Nov 2011 13:16:44 -0700 Subject: [PATCH 13/40] Tightened up destructive iteration description. --- sections/control_flow.pod | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/sections/control_flow.pod b/sections/control_flow.pod index 9ff6270c..ca4ffbc9 100644 --- a/sections/control_flow.pod +++ b/sections/control_flow.pod @@ -720,11 +720,9 @@ C<@values> array by modifying the array with each loop iteration: =begin sidebar -You might also write a C loop that does the I of -the C<@values> array inside the C condition check. This is a common -and idiomatic construct, but has some subtleties that aren't immediately -obvious to beginners. - +Modifying C<@values> inside of the C condition check also works, but it +has some subtleties related to the truthiness of each value. + =begin programlisting while (my $value = shift @values) @@ -734,9 +732,9 @@ obvious to beginners. =end programlisting -This loop will exit as soon as it reaches an element that evaluates to a -false or undefined value, not necessarily when it has exhausted the array. -That may be the desired behavior, but is often surprising to novices. +This loop will exit as soon as it reaches an element that evaluates to a false +value, not necessarily when it has exhausted the array. That may be the desired +behavior, but is often surprising to novices. =end sidebar From 4b98cfa44a8ca19d5499a720a876fb3b1e51c53c Mon Sep 17 00:00:00 2001 From: chromatic Date: Wed, 2 Nov 2011 13:17:55 -0700 Subject: [PATCH 14/40] Slightly improved paragraph mode description. --- sections/globals.pod | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sections/globals.pod b/sections/globals.pod index 59c5fc5c..c3019ff9 100644 --- a/sections/globals.pod +++ b/sections/globals.pod @@ -123,9 +123,9 @@ reading input a line at a time. By default, this is your platform-specific newline character sequence. If you undefine this value, Perl will attempt to read the entire file into memory. If you set this value to a I to an integer, Perl will try to read that many I per record (so beware of -Unicode concerns). If you set this value to an empty string: C<''>, the file -will be read in "paragraph" mode. (Chunks of text separated by an arbitrary -number of newlines.) +Unicode concerns). If you set this value to an empty string (C<''>), Perl will +read in a paragraph at a time, where a paragraph is a chunk of text followed by +an arbitrary number of newlines. X> X> From 635e79fd5691cd9554dc16d60add3ca8f37028bc Mon Sep 17 00:00:00 2001 From: hurdlecrew Date: Tue, 1 Nov 2011 23:51:36 -0400 Subject: [PATCH 15/40] A few minor grammar/syntax mods to functions.pod --- sections/functions.pod | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sections/functions.pod b/sections/functions.pod index c582698c..b65e5b9b 100644 --- a/sections/functions.pod +++ b/sections/functions.pod @@ -133,8 +133,8 @@ code uses C or list unpacking: =begin sidebar -Remember that the array builtins default to C<@_> as operand within functions. -Take advantage of this idiom. +Remember that the array builtins use C<@_> as the default operand. Take +advantage of this idiom. =end sidebar @@ -245,7 +245,7 @@ immediately followed by its value. Hash assignment inside C works essentially as the more explicit assignment to C<%pet_names_and_types> does. This flattening is often useful, but beware of mixing scalars with flattened -aggregates in parameter lists. To write C function, where +aggregates in parameter lists. To write a C function, where one parameter is the type of pet to display, pass that type as the I parameter (or use C to remove it from the end of C<@_>): @@ -561,7 +561,7 @@ functions. X> X> -robin Houston's C and Damian Conway's C distributions +Robin Houston's C and Damian Conway's C distributions from the CPAN offer many possibilities for writing powerful and usable context-aware interfaces. From 4f28293b96555b74c3a0f82cdbee8cb72ff3e5d8 Mon Sep 17 00:00:00 2001 From: chromatic Date: Wed, 2 Nov 2011 13:26:18 -0700 Subject: [PATCH 16/40] Fixed some whitespace issues. --- sections/chapter_02.pod | 2 +- sections/functions.pod | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sections/chapter_02.pod b/sections/chapter_02.pod index 3366fa7f..bcf28877 100644 --- a/sections/chapter_02.pod +++ b/sections/chapter_02.pod @@ -13,7 +13,7 @@ people. I make a community worth joining and preserving and expanding. The Perl community is strong and healthy. It welcomes willing participants at all levels, from novices to core developers. Take advantage of the knowledge and experience of countless other Perl programmers, and you'll become a better -programmer. +programmer. L diff --git a/sections/functions.pod b/sections/functions.pod index b65e5b9b..5c365e9a 100644 --- a/sections/functions.pod +++ b/sections/functions.pod @@ -133,7 +133,7 @@ code uses C or list unpacking: =begin sidebar -Remember that the array builtins use C<@_> as the default operand. Take +Remember that the array builtins use C<@_> as the default operand. Take advantage of this idiom. =end sidebar From 1b1a7b5a2d12415326e6a4e61ac91dc6a9be8b2c Mon Sep 17 00:00:00 2001 From: chromatic Date: Wed, 2 Nov 2011 13:33:41 -0700 Subject: [PATCH 17/40] Tidied CPAN installation section (GH #172). --- sections/cpan.pod | 22 +++++++++++++++------- sections/expressivity.pod | 30 +++++++++++++++++------------- 2 files changed, 32 insertions(+), 20 deletions(-) diff --git a/sections/cpan.pod b/sections/cpan.pod index a0e4e49e..d2dcae53 100644 --- a/sections/cpan.pod +++ b/sections/cpan.pod @@ -69,12 +69,11 @@ X> X> Modern Perl installations include two clients to connect to, search, download, -build, test, and install CPAN distributions, CPAN.pm and CPANPLUS. A newer -alternative is also available, though it is not part of the core distribution. -For the most part, each of these clients is equivalent for basic installation. -This book recommends the use of CPAN.pm solely due to its ubiquity. With a -recent version (as of this writing, 1.9800 is the latest stable release), -module installation is reasonably easy. Start the client with: +build, test, and install CPAN distributions, CPAN.pm and CPANPLUS. For the most +part, each of these clients is equivalent for basic installation. This book +recommends the use of CPAN.pm solely due to its ubiquity. With a recent version +(as of this writing, 1.9800 is the latest stable release), module installation +is reasonably easy. Start the client with: =begin screen @@ -82,7 +81,16 @@ module installation is reasonably easy. Start the client with: =end screen -To install a distribution: +To install a distribution within the client: + +=begin screen + + $ B + cpan[1]> B + +=end + +... or to install directly from the command line: =begin screen diff --git a/sections/expressivity.pod b/sections/expressivity.pod index d96e61d6..34cc96ba 100644 --- a/sections/expressivity.pod +++ b/sections/expressivity.pod @@ -67,21 +67,16 @@ the sense that most everyone wants to help babies learn to communicate well. Everyone begins as a novice. Through practice and learning from more experienced programmers, you will understand and adopt more powerful idioms and techniques. -For example, a Perl novice might triple a list of numbers by writing: +For example, an experienced Perl hacker might triple a list of numbers by +writing: =begin programlisting - my @tripled; - my $count = @numbers; - - for (my $i = 0; $i < $count; $i++) - { - $tripled[$i] = $numbers[$i] * 3; - } + my @tripled = map { $_ * 3 } @numbers; =end programlisting -A Perl adept might write: +... and a Perl adept might write: =begin programlisting @@ -94,17 +89,26 @@ A Perl adept might write: =end programlisting -An experienced Perl hacker might write: +... while a novice might start with: =begin programlisting - my @tripled = map { $_ * 3 } @numbers; + my @tripled; + my $count = @numbers; + + for (my $i = 0; $i < $count; $i++) + { + $tripled[$i] = $numbers[$i] * 3; + } =end programlisting +All three approaches accomplish the same thing, but each takes advantage of +Perl in a different way. + Experience writing Perl will help you to focus on I you want to do rather than I to do it. Even so, Perl will happily run simple programs. You can design and refine your programs for clarity, expressivity, reuse, and maintainability, in part or in whole. Take advantage of this flexibility and -pragmatism: it's far better to accomplish your task effectively now than to write a -conceptually pure and beautiful program next year. +pragmatism: it's far better to accomplish your task effectively now than to +write a conceptually pure and beautiful program next year. From 9c0a52a8f7a7daa5c2a72cd4513449fced94d7a1 Mon Sep 17 00:00:00 2001 From: chromatic Date: Wed, 2 Nov 2011 13:38:07 -0700 Subject: [PATCH 18/40] Improved explanation of octals (GH #182). --- sections/values.pod | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sections/values.pod b/sections/values.pod index 3b2a587e..20630e78 100644 --- a/sections/values.pod +++ b/sections/values.pod @@ -567,8 +567,8 @@ X> X> The emboldened characters are the numeric prefixes for binary, octal, and hex -notation respectively. Be aware that a leading zero I indicates octal -mode. +notation respectively. Be aware that a leading zero on an integer I +indicates octal mode. X X From b85b14d2733773102a57ca095b1c41e9af99fa1e Mon Sep 17 00:00:00 2001 From: chromatic Date: Wed, 2 Nov 2011 13:41:18 -0700 Subject: [PATCH 19/40] Fixed version check programlisting site (GH #187). --- sections/packages.pod | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sections/packages.pod b/sections/packages.pod index 27ada5ec..1d55dea0 100644 --- a/sections/packages.pod +++ b/sections/packages.pod @@ -122,11 +122,11 @@ argument: # require at least 2.1 Some::Plugin->VERSION( 2.1 ); -=end programlisting - die "Your plugin $version is too old" unless $version > 2; +=end programlisting + =head2 Packages and Namespaces X From 895c5604c14f7fbce3259e20bcbd8050753d8b54 Mon Sep 17 00:00:00 2001 From: chromatic Date: Wed, 2 Nov 2011 13:43:13 -0700 Subject: [PATCH 20/40] Avoided confusing array name reuse (GH #189). --- sections/arrays.pod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sections/arrays.pod b/sections/arrays.pod index b50c3557..64455780 100644 --- a/sections/arrays.pod +++ b/sections/arrays.pod @@ -227,7 +227,7 @@ used as its index: =begin programlisting # function called in list context - my @cats = @cats[ get_cat_indices() ]; + my @hungry_cats = @cats[ get_cat_indices() ]; =end programlisting From 1b555d89443fc39163dfa964147454061d41971f Mon Sep 17 00:00:00 2001 From: chromatic Date: Wed, 2 Nov 2011 13:44:45 -0700 Subject: [PATCH 21/40] Belgians consider waffles as dessert (GH #190). Far be it from me to argue with peaceful people who invented waffles and Smurfs. --- sections/references.pod | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sections/references.pod b/sections/references.pod index 7cb15ed6..c308e0ce 100644 --- a/sections/references.pod +++ b/sections/references.pod @@ -217,7 +217,7 @@ scoping. For example: =begin programlisting - my @meals = qw( waffles sandwiches pizza ); + my @meals = qw( soup sandwiches pizza ); my $sunday_ref = \@meals; my $monday_ref = \@meals; @@ -229,7 +229,7 @@ scoping. For example: =begin programlisting - my @meals = qw( waffles sandwiches pizza ); + my @meals = qw( soup sandwiches pizza ); my $sunday_ref = [ @meals ]; my $monday_ref = [ @meals ]; From 62ff5e8152fd994607f6b9a151b4ce78cec056ad Mon Sep 17 00:00:00 2001 From: chromatic Date: Wed, 2 Nov 2011 13:55:29 -0700 Subject: [PATCH 22/40] Improved footnote formatting. --- CREDITS | 3 +++ sections/indirect_objects.pod | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CREDITS b/CREDITS index 542a0de3..db9d9a99 100644 --- a/CREDITS +++ b/CREDITS @@ -218,3 +218,6 @@ E: thundergnat@gmail.com N: Anneli Cuss E: celtic@sairyx.org + +N: Andy Lester +E: andy@petdance.com diff --git a/sections/indirect_objects.pod b/sections/indirect_objects.pod index 455f491c..7ab437e0 100644 --- a/sections/indirect_objects.pod +++ b/sections/indirect_objects.pod @@ -109,7 +109,7 @@ For the limited case of filehandle operations, the dative use is so prevalent that you can use the indirect invocation approach if you surround your intended invocant with curly brackets. If you're using Perl 5.14 (or if you load C or C), you can use methods on lexical -filehandlesN< and C though.>>. +filehandlesN and C though.>. X> X> From 06a6c808dedd2463ad2c7ef7b7dac34f15eb2457 Mon Sep 17 00:00:00 2001 From: chromatic Date: Wed, 2 Nov 2011 13:55:52 -0700 Subject: [PATCH 23/40] Fixed invalid screen markup. --- sections/cpan.pod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sections/cpan.pod b/sections/cpan.pod index d2dcae53..44bfe54b 100644 --- a/sections/cpan.pod +++ b/sections/cpan.pod @@ -88,7 +88,7 @@ To install a distribution within the client: $ B cpan[1]> B -=end +=end screen ... or to install directly from the command line: From 809e5152f8ab49056ce2491fc5080b222f58b989 Mon Sep 17 00:00:00 2001 From: chromatic Date: Wed, 2 Nov 2011 16:06:29 -0700 Subject: [PATCH 24/40] Fixed buggy table layout. --- sections/files.pod | 2 -- 1 file changed, 2 deletions(-) diff --git a/sections/files.pod b/sections/files.pod index ade289c8..ccffafc5 100644 --- a/sections/files.pod +++ b/sections/files.pod @@ -65,8 +65,6 @@ Z =headrow -=row - =cell Symbols =cell Explanation From c833d3a0969976e98878a5545e73b1d372d68e01 Mon Sep 17 00:00:00 2001 From: chromatic Date: Wed, 2 Nov 2011 16:18:04 -0700 Subject: [PATCH 25/40] Improved tip formatting. --- sections/idioms.pod | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sections/idioms.pod b/sections/idioms.pod index bd94fa4d..4a61c61c 100644 --- a/sections/idioms.pod +++ b/sections/idioms.pod @@ -462,9 +462,7 @@ This technique works on other in-place modification operators: =begin tip /r in Perl 5.14 Perl 5.14 added the non-destructive substitution modifier C, so that you -can write: - - C;> +can write C;>. =end tip From 2fbd02e4fbf4a0bdf7abbc5642f74e3abb0f118c Mon Sep 17 00:00:00 2001 From: Mark Nevergoski Date: Wed, 2 Nov 2011 20:37:01 -0400 Subject: [PATCH 26/40] Rolling back. --- sections/context_philosophy.pod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sections/context_philosophy.pod b/sections/context_philosophy.pod index 7d1048d9..05e2a5fb 100644 --- a/sections/context_philosophy.pod +++ b/sections/context_philosophy.pod @@ -197,7 +197,7 @@ X> The C operator treats its operands as strings by enforcing I on them. The C<==> operator imposes I. In numeric -context, both strings evaluate to numbers C<0> (L). +context, both strings evaluate to C<0> (L). X X From c717252b4fab3a9a61c17cf56175af0e0ed3485f Mon Sep 17 00:00:00 2001 From: Mark Nevergoski Date: Wed, 2 Nov 2011 21:33:10 -0400 Subject: [PATCH 27/40] Ending the sentence with "can simplify" was jarring. --- sections/cpan.pod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sections/cpan.pod b/sections/cpan.pod index 44bfe54b..4f2423cb 100644 --- a/sections/cpan.pod +++ b/sections/cpan.pod @@ -153,7 +153,7 @@ The C CPAN distribution allows you to install and to manage distributions in your own user directory, rather than for the system as a whole. This is an effective way to maintain CPAN distributions without affecting other users. Installation is somewhat more involved than the previous -two distributions, though C can simplify. See +two distributions, though C can simplify the process. See U and U for more details. From 42bb18b2bbe9892f36f042e56920305bfef44949 Mon Sep 17 00:00:00 2001 From: Mark Nevergoski Date: Wed, 2 Nov 2011 23:42:33 -0400 Subject: [PATCH 28/40] s/cookies/the cookies/ so the sentence flows better s/a IO/an IO/ especially since next sentence starts with "An IO". Rewording a sentence about concatenating strings with different encodings. Added missing period at the end of a sentence (before "N When you tell Perl that a specific filehandle (L) works with encoded text, Perl will convert the incoming octets to Unicode strings automatically. -To do this, add a IO layer to the mode of the C builtin. An I +To do this, add an IO layer to the mode of the C builtin. An I wraps around input or output and converts the data. In this case, the C<:utf8> layer decodes UTF-8 data: @@ -509,8 +509,8 @@ produce another Unicode string. If both strings are octet streams, Perl will concatenate them into a new octet string. If both values are octets of the same encoding--both Latin-1, for example, the concatenation will work correctly. If the octets do not share an -encoding, the concatenation append UTF-8 data to Latin-1 data, producing a -sequence of octets which makes sense in I encoding. This could happen +encoding, for example a concatenation appending UTF-8 data to Latin-1 data, then the +resulting sequence of octets makes sense in I encoding. This could happen if the user entered a name as UTF-8 data and the greeting were a Latin-1 string literal, but the program decoded neither. @@ -523,7 +523,7 @@ I> because the UTF-8 data means something else when decoded as Latin-1 data. See C for a far more detailed explanation of Unicode, -encodings, and how to manage incoming and outgoing data in a Unicode worldN more detail about managing Unicode effectively throughout your programs, see Tom Christiansen's answer to "Why does Modern Perl avoid UTF-8 by default?" U>. From 99faa698b6c00a835f67ed465a00bc961fc39573 Mon Sep 17 00:00:00 2001 From: Steve Dickinson Date: Thu, 3 Nov 2011 22:10:50 -0400 Subject: [PATCH 29/40] Added variable declaration to clarify intention of the statement short-circuiting. --- sections/control_flow.pod | 1 + 1 file changed, 1 insertion(+) diff --git a/sections/control_flow.pod b/sections/control_flow.pod index ca4ffbc9..76c05e68 100644 --- a/sections/control_flow.pod +++ b/sections/control_flow.pod @@ -346,6 +346,7 @@ using an undefined value might raise a warning: =begin programlisting + my $barbeque; if (defined $barbeque and $barbeque eq 'pork shoulder') { ... } =end programlisting From 63f04cab4e61400dbcbcae6d70faf4d85259cdaf Mon Sep 17 00:00:00 2001 From: Steve Dickinson Date: Thu, 3 Nov 2011 22:12:12 -0400 Subject: [PATCH 30/40] Added Steve Dickinson to CREDITS. --- CREDITS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CREDITS b/CREDITS index db9d9a99..6e111692 100644 --- a/CREDITS +++ b/CREDITS @@ -221,3 +221,6 @@ E: celtic@sairyx.org N: Andy Lester E: andy@petdance.com + +N: Steve Dickinson +E: dsdickinson@gmail.com From 22ef60d08c7572661985b2ed63c59c2e5494dce5 Mon Sep 17 00:00:00 2001 From: Steve Dickinson Date: Thu, 3 Nov 2011 22:57:34 -0400 Subject: [PATCH 31/40] Added "respectively" for clarity and consistency with previous explanation. --- sections/arrays.pod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sections/arrays.pod b/sections/arrays.pod index 64455780..eea0773d 100644 --- a/sections/arrays.pod +++ b/sections/arrays.pod @@ -267,7 +267,7 @@ X> X> Similarly, C and C add elements to and remove an element from -the start of an array: +the start of an array, respectively: =begin programlisting From 6ec066f566db9d86d80db0b8c65c1490df4909d1 Mon Sep 17 00:00:00 2001 From: Steve Dickinson Date: Thu, 3 Nov 2011 23:05:50 -0400 Subject: [PATCH 32/40] s/her/their/ to remove gender reference. --- sections/hashes.pod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sections/hashes.pod b/sections/hashes.pod index c2939a1f..0cfbd818 100644 --- a/sections/hashes.pod +++ b/sections/hashes.pod @@ -7,7 +7,7 @@ X A I is a first-class Perl data structure which associates string keys with scalar values. In the same way that the name of a variable corresponds to a storage location, a key in a hash refers to a value. Think of a hash like you -would a telephone book: use your friend's name to look up her number. Other +would a telephone book: use your friend's name to look up their number. Other languages call hashes I, I, I, or I. From e6489ff438706abf140d1b2767c3af94a32bbe82 Mon Sep 17 00:00:00 2001 From: Mark Nevergoski Date: Fri, 4 Nov 2011 00:58:29 -0400 Subject: [PATCH 33/40] Rollback --- sections/values.pod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sections/values.pod b/sections/values.pod index 3370dcff..5c2628c6 100644 --- a/sections/values.pod +++ b/sections/values.pod @@ -523,7 +523,7 @@ I> because the UTF-8 data means something else when decoded as Latin-1 data. See C for a far more detailed explanation of Unicode, -encodings, and how to manage incoming and outgoing data in a Unicode world. N more detail about managing Unicode effectively throughout your programs, see Tom Christiansen's answer to "Why does Modern Perl avoid UTF-8 by default?" U>. From d394c0c44f4ba82658108a7e07c0eaa7b19cde85 Mon Sep 17 00:00:00 2001 From: Steve Dickinson Date: Sat, 5 Nov 2011 10:37:57 -0400 Subject: [PATCH 34/40] Added a 'times' function to make the example more clear since the example is using this function. --- sections/anonymous_functions.pod | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sections/anonymous_functions.pod b/sections/anonymous_functions.pod index 5d9b1b7a..ea7f6a4b 100644 --- a/sections/anonymous_functions.pod +++ b/sections/anonymous_functions.pod @@ -22,12 +22,13 @@ input with behavior: ( plus => \&add_two_numbers, minus => \&subtract_two_numbers, + times => \&multiply_two_numbers, # ... and so on ); sub add_two_numbers { $_[0] + $_[1] } - sub subtract_two_numbers { $_[0] - $_[1] } + sub multiply_two_numbers { $_[0] * $_[1] } sub dispatch { From 309ca462dff610003f1a71daab0bde201744f26c Mon Sep 17 00:00:00 2001 From: Steve Dickinson Date: Sat, 5 Nov 2011 10:41:03 -0400 Subject: [PATCH 35/40] Added missing word. --- sections/hashes.pod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sections/hashes.pod b/sections/hashes.pod index 0cfbd818..24a3e5c4 100644 --- a/sections/hashes.pod +++ b/sections/hashes.pod @@ -438,7 +438,7 @@ you can safely ignore. In list context, a hash evaluates to a list of key/value pairs similar to what you receive from the C operator. However, you I iterate over this list the same way you can iterate over the list produced by C, lest -the loop never terminate: +the loop will never terminate: =begin programlisting From b1e59b222103eb3b3d727c2bda05719aad46f12a Mon Sep 17 00:00:00 2001 From: Steve Dickinson Date: Sat, 5 Nov 2011 10:42:01 -0400 Subject: [PATCH 36/40] Added word for clarity. --- sections/references.pod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sections/references.pod b/sections/references.pod index c308e0ce..49ec7316 100644 --- a/sections/references.pod +++ b/sections/references.pod @@ -29,7 +29,7 @@ anything could possibly change them out from under you, you'd have to write lots of extra defensive code. Yet sometimes it's useful to modify values in place. If you want to pass a hash -full of data to a function to modify, creating and returning a new hash for +full of data to a function to modify it, creating and returning a new hash for each change could be troublesome (to say nothing of inefficient). X From ba6e6fef54b968fae15d9d912c4c362ae64036e6 Mon Sep 17 00:00:00 2001 From: Steve Dickinson Date: Sat, 5 Nov 2011 10:42:54 -0400 Subject: [PATCH 37/40] Fixed a fragmented sentence. --- sections/scope.pod | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sections/scope.pod b/sections/scope.pod index dc0bc201..d6f2c65d 100644 --- a/sections/scope.pod +++ b/sections/scope.pod @@ -108,9 +108,9 @@ outer scope hides, or I, the outer lexical: =end programlisting This program prints C and then CN. Even though redeclaring a lexical variable with the same name and -type I produces a warning message, shadowing a -lexical. This is a feature of encapsulation. +vampires.>, even though redeclaring a lexical variable with the same name and +type I produces a warning message. Shadowing a +lexical is a feature of encapsulation. =begin sidebar From 770b79694d621cee87b2bf426211325aea3ed68e Mon Sep 17 00:00:00 2001 From: chromatic Date: Tue, 8 Nov 2011 12:30:11 -0800 Subject: [PATCH 38/40] Rephrased for optimal pronoun number agreement. --- sections/hashes.pod | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sections/hashes.pod b/sections/hashes.pod index 24a3e5c4..a7b37b0f 100644 --- a/sections/hashes.pod +++ b/sections/hashes.pod @@ -7,9 +7,9 @@ X A I is a first-class Perl data structure which associates string keys with scalar values. In the same way that the name of a variable corresponds to a storage location, a key in a hash refers to a value. Think of a hash like you -would a telephone book: use your friend's name to look up their number. Other -languages call hashes I, I, I, or -I. +would a telephone book: use the names of your friends to look up their numbers. +Other languages call hashes I, I, I, +or I. Hashes have two important properties: they store one scalar per unique key and they provide no specific ordering of keys. From 8926881056710a025c1e6c700bf7f858159f3de8 Mon Sep 17 00:00:00 2001 From: chromatic Date: Tue, 8 Nov 2011 12:33:18 -0800 Subject: [PATCH 39/40] Manually applied PR #196 from Kurt Edmiston. --- CREDITS | 3 +++ sections/functions.pod | 4 ++-- sections/references.pod | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CREDITS b/CREDITS index 6e111692..4a9cff6b 100644 --- a/CREDITS +++ b/CREDITS @@ -224,3 +224,6 @@ E: andy@petdance.com N: Steve Dickinson E: dsdickinson@gmail.com + +N: Kurt Edmiston +E: hurdlecrew@gmail.com diff --git a/sections/functions.pod b/sections/functions.pod index 5c365e9a..44aa7706 100644 --- a/sections/functions.pod +++ b/sections/functions.pod @@ -133,8 +133,8 @@ code uses C or list unpacking: =begin sidebar -Remember that the array builtins use C<@_> as the default operand. Take -advantage of this idiom. +Remember that the array builtins use C<@_> as the default operand I. Take advantage of this idiom. =end sidebar diff --git a/sections/references.pod b/sections/references.pod index 49ec7316..23a4ae93 100644 --- a/sections/references.pod +++ b/sections/references.pod @@ -82,7 +82,7 @@ dereferencing: =end programlisting -The double scalar sigil dereferences a scalar reference. +The double scalar sigil (C<$$>) dereferences a scalar reference. =begin sidebar From c9259dfd35f4f8a5c860fcbd879bfa928366e8ba Mon Sep 17 00:00:00 2001 From: chromatic Date: Tue, 8 Nov 2011 12:35:35 -0800 Subject: [PATCH 40/40] Tidied sentence. --- sections/values.pod | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sections/values.pod b/sections/values.pod index 5c2628c6..4a2b564e 100644 --- a/sections/values.pod +++ b/sections/values.pod @@ -12,10 +12,10 @@ Where variables allow the abstract manipulation of data, the values they hold make programs concrete and useful. The more accurate your values, the better your programs. These values are data--your aunt's name and address, the distance between your office and a golf course on the moon, or the weight of -all the cookies you've eaten in the past year. Within your program, the rules -regarding the format of that data are often strict. Effective programs need -effective (simple, fast, most compact, most efficient) ways of representing -their data. +all of the cookies you've eaten in the past year. Within your program, the +rules regarding the format of that data are often strict. Effective programs +need effective (simple, fast, most compact, most efficient) ways of +representing their data. =head2 Strings