diff options
author | Karen Etheridge <ether@cpan.org> | 2014-10-18 19:12:09 -0700 |
---|---|---|
committer | James E Keenan <jkeenan@cpan.org> | 2014-10-19 08:16:57 -0400 |
commit | f837890d252c44f187c77b82f2473886a55562b4 (patch) | |
tree | 0d58241d004961cf0c0dde0128d85bfc1d910ef8 /cpan/perlfaq | |
parent | 4879569396cd10fcd8928d5e188b587c8e47efe5 (diff) | |
download | perl-f837890d252c44f187c77b82f2473886a55562b4.tar.gz |
Update perlfaq to version 5.015046
Diffstat (limited to 'cpan/perlfaq')
-rw-r--r-- | cpan/perlfaq/lib/perlfaq.pm | 6 | ||||
-rw-r--r-- | cpan/perlfaq/lib/perlfaq2.pod | 2 | ||||
-rw-r--r-- | cpan/perlfaq/lib/perlfaq4.pod | 2 | ||||
-rw-r--r-- | cpan/perlfaq/lib/perlfaq5.pod | 14 | ||||
-rw-r--r-- | 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 9a64d66284..e39ba5dbc9 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 ce7cd1b3b2..4f0a4137cd 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 f615bf4bf9..1f9fc92859 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 a8d4478d78..1ab722c2b4 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 db1064302a..1ab5502b96 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> > |