In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/f837890d252c44f187c77b82f2473886a55562b4?hp=4879569396cd10fcd8928d5e188b587c8e47efe5>
- Log ----------------------------------------------------------------- commit f837890d252c44f187c77b82f2473886a55562b4 Author: Karen Etheridge <[email protected]> Date: Sat Oct 18 19:12:09 2014 -0700 Update perlfaq to version 5.015046 ----------------------------------------------------------------------- Summary of changes: cpan/perlfaq/lib/perlfaq.pm | 6 ++++-- cpan/perlfaq/lib/perlfaq2.pod | 2 +- cpan/perlfaq/lib/perlfaq4.pod | 2 +- cpan/perlfaq/lib/perlfaq5.pod | 14 +++++++------- cpan/perlfaq/lib/perlfaq6.pod | 4 ++-- 5 files changed, 15 insertions(+), 13 deletions(-) diff --git a/cpan/perlfaq/lib/perlfaq.pm b/cpan/perlfaq/lib/perlfaq.pm index 9a64d66..e39ba5d 100644 --- a/cpan/perlfaq/lib/perlfaq.pm +++ b/cpan/perlfaq/lib/perlfaq.pm @@ -1,3 +1,5 @@ +use strict; +use warnings; package perlfaq; -$perlfaq::VERSION = '5.0150045'; -0; # not is it supposed to be loaded +$perlfaq::VERSION = '5.0150046'; +1; diff --git a/cpan/perlfaq/lib/perlfaq2.pod b/cpan/perlfaq/lib/perlfaq2.pod index ce7cd1b..4f0a413 100644 --- a/cpan/perlfaq/lib/perlfaq2.pod +++ b/cpan/perlfaq/lib/perlfaq2.pod @@ -174,7 +174,7 @@ There's also I<$foo Magazin>, a German magazine dedicated to Perl, at German-speaking magazine for Perl beginners (see L<http://perl-zeitung.at.tf> ). -Several unix/linux releated magazines frequently includes articles on Perl. +Several unix/linux related magazines frequently includes articles on Perl. =head2 Which Perl blogs should I read? diff --git a/cpan/perlfaq/lib/perlfaq4.pod b/cpan/perlfaq/lib/perlfaq4.pod index f615bf4..1f9fc92 100644 --- a/cpan/perlfaq/lib/perlfaq4.pod +++ b/cpan/perlfaq/lib/perlfaq4.pod @@ -730,7 +730,7 @@ L<Regexp::Common::balanced> and L<Regexp::Common::delimited>). More complex cases will require to write a parser, probably using a parsing module from CPAN, like L<Regexp::Grammars>, L<Parse::RecDescent>, L<Parse::Yapp>, -L<Text::Balanced>, or L<Marpa::XS>. +L<Text::Balanced>, or L<Marpa::R2>. =head2 How do I reverse a string? diff --git a/cpan/perlfaq/lib/perlfaq5.pod b/cpan/perlfaq/lib/perlfaq5.pod index a8d4478..1ab722c 100644 --- a/cpan/perlfaq/lib/perlfaq5.pod +++ b/cpan/perlfaq/lib/perlfaq5.pod @@ -200,7 +200,7 @@ you can fit the whole thing in memory!): print $out $content; -Modules such as L<File::Slurp> and L<Tie::File> can help with that +Modules such as L<Path::Tiny> and L<Tie::File> can help with that too. If you can, however, avoid reading the entire file at once. Perl won't give that memory back to the operating system until the process finishes. @@ -280,7 +280,7 @@ newlines: while( sysread $fh, $buffer, 4096 ) { $lines += ( $buffer =~ tr/\n// ); } - close FILE; + close $fh; However, that doesn't work if the line ending isn't a newline. You might change that C<tr///> to a C<s///> so you can count the number of @@ -291,7 +291,7 @@ times the input record separator, C<$/>, shows up: while( sysread $fh, $buffer, 4096 ) { $lines += ( $buffer =~ s|$/||g; ); } - close FILE; + close $fh; If you don't mind shelling out, the C<wc> command is usually the fastest, even with the extra interprocess overhead. Ensure that you @@ -1135,13 +1135,13 @@ C<$DB_RECNO> bindings, which allow you to tie an array to a file so that accessing an element of the array actually accesses the corresponding line in the file. -If you want to load the entire file, you can use the L<File::Slurp> +If you want to load the entire file, you can use the L<Path::Tiny> module to do it in one simple and efficient step: - use File::Slurp; + use Path::Tiny; - my $all_of_it = read_file($filename); # entire file in scalar - my @all_lines = read_file($filename); # one line per element + my $all_of_it = path($filename)->slurp; # entire file in scalar + my @all_lines = path($filename)->lines; # one line per element Or you can read the entire file contents into a scalar like this: diff --git a/cpan/perlfaq/lib/perlfaq6.pod b/cpan/perlfaq/lib/perlfaq6.pod index db10643..1ab5502 100644 --- a/cpan/perlfaq/lib/perlfaq6.pod +++ b/cpan/perlfaq/lib/perlfaq6.pod @@ -546,7 +546,7 @@ The output shows that Perl found the two major groups: <brackets in <nested brackets> > <another group <nested once <nested twice> > > -With a little extra work, you can get the all of the groups in angle +With a little extra work, you can get all of the groups in angle brackets even if they are in other angle brackets too. Each time you get a balanced match, remove its outer delimiter (that's the one you just matched so don't match it again) and add it to a queue of strings @@ -584,7 +584,7 @@ to process. Keep doing that until you get no matches: } The output shows all of the groups. The outermost matches show up -first and the nested matches so up later: +first and the nested matches show up later: Found: <brackets in <nested brackets> > -- Perl5 Master Repository
