summaryrefslogtreecommitdiff
path: root/cpan
diff options
context:
space:
mode:
authorKaren Etheridge <ether@cpan.org>2020-11-07 13:04:53 -0800
committerKaren Etheridge <ether@cpan.org>2020-11-07 13:04:53 -0800
commit09e51a9507d43423f742dc54ce0b004c36dfc43b (patch)
tree38a7f88eb2f7d0800bc4650a1a5a8f9dd47d4e0a /cpan
parentea7c1d7ae3e91620c032d9c5be667b4c4fd8e055 (diff)
downloadperl-09e51a9507d43423f742dc54ce0b004c36dfc43b.tar.gz
Update perlfaq to CPAN version 5.20200523
[DELTA] 5.20201107 2020-11-07 21:02:39Z * typo fix (PR#90, Samanta Navarro) * fix learn.perl.org link, which now directs to perldoc.perl.org (PR#91, Dan Book) * modern updates to "How do I efficiently match many regular expressions" (PR#92, Dan Book)
Diffstat (limited to 'cpan')
-rw-r--r--cpan/perlfaq/lib/perlfaq.pm2
-rw-r--r--cpan/perlfaq/lib/perlfaq.pod9
-rw-r--r--cpan/perlfaq/lib/perlfaq1.pod2
-rw-r--r--cpan/perlfaq/lib/perlfaq2.pod4
-rw-r--r--cpan/perlfaq/lib/perlfaq3.pod2
-rw-r--r--cpan/perlfaq/lib/perlfaq4.pod2
-rw-r--r--cpan/perlfaq/lib/perlfaq5.pod2
-rw-r--r--cpan/perlfaq/lib/perlfaq6.pod53
-rw-r--r--cpan/perlfaq/lib/perlfaq7.pod2
-rw-r--r--cpan/perlfaq/lib/perlfaq8.pod2
-rw-r--r--cpan/perlfaq/lib/perlfaq9.pod2
-rw-r--r--cpan/perlfaq/lib/perlglossary.pod4
12 files changed, 38 insertions, 48 deletions
diff --git a/cpan/perlfaq/lib/perlfaq.pm b/cpan/perlfaq/lib/perlfaq.pm
index c8016cf523..3dd5421987 100644
--- a/cpan/perlfaq/lib/perlfaq.pm
+++ b/cpan/perlfaq/lib/perlfaq.pm
@@ -2,6 +2,6 @@ use strict;
use warnings;
package perlfaq;
-our $VERSION = '5.20200523';
+our $VERSION = '5.20201107';
1;
diff --git a/cpan/perlfaq/lib/perlfaq.pod b/cpan/perlfaq/lib/perlfaq.pod
index 3b7345aa64..de114be28a 100644
--- a/cpan/perlfaq/lib/perlfaq.pod
+++ b/cpan/perlfaq/lib/perlfaq.pod
@@ -4,7 +4,7 @@ perlfaq - Frequently asked questions about Perl
=head1 VERSION
-version 5.20200523
+version 5.20201107
=head1 DESCRIPTION
@@ -15,7 +15,7 @@ into nine major sections outlined in this document.
=head2 Where to find the perlfaq
The perlfaq is an evolving document. Read the latest version at
-L<http://learn.perl.org/faq/>. It is also included in the standard Perl
+L<https://perldoc.perl.org/perlfaq>. It is also included in the standard Perl
distribution.
=head2 How to use the perlfaq
@@ -35,9 +35,8 @@ Review L<https://github.com/perl-doc-cats/perlfaq/wiki>. If you don't find
your suggestion create an issue or pull request against
L<https://github.com/perl-doc-cats/perlfaq>.
-Once approved, changes are merged into L<https://github.com/tpf/perlfaq>, the
-repository which drives L<http://learn.perl.org/faq/>, and they are
-distributed with the next Perl 5 release.
+Once approved, changes will be distributed with the next Perl release and
+subsequently appear at L<https://perldoc.perl.org/perlfaq>.
=head2 What if my question isn't answered in the FAQ?
diff --git a/cpan/perlfaq/lib/perlfaq1.pod b/cpan/perlfaq/lib/perlfaq1.pod
index 0ec9f16161..e8ecaffe3b 100644
--- a/cpan/perlfaq/lib/perlfaq1.pod
+++ b/cpan/perlfaq/lib/perlfaq1.pod
@@ -4,7 +4,7 @@ perlfaq1 - General Questions About Perl
=head1 VERSION
-version 5.20200523
+version 5.20201107
=head1 DESCRIPTION
diff --git a/cpan/perlfaq/lib/perlfaq2.pod b/cpan/perlfaq/lib/perlfaq2.pod
index 447ad087eb..614aac9190 100644
--- a/cpan/perlfaq/lib/perlfaq2.pod
+++ b/cpan/perlfaq/lib/perlfaq2.pod
@@ -4,7 +4,7 @@ perlfaq2 - Obtaining and Learning about Perl
=head1 VERSION
-version 5.20200523
+version 5.20201107
=head1 DESCRIPTION
@@ -230,7 +230,7 @@ wanted to report a bug in L<Business::ISBN>, you could send a message to
bug-Business-ISBN@rt.cpan.org .
Some modules might have special reporting requirements, such as a
-Github or Google Code tracking system, so you should check the
+GitHub or Google Code tracking system, so you should check the
module documentation too.
=head1 AUTHOR AND COPYRIGHT
diff --git a/cpan/perlfaq/lib/perlfaq3.pod b/cpan/perlfaq/lib/perlfaq3.pod
index 481c3c9467..017ab38afb 100644
--- a/cpan/perlfaq/lib/perlfaq3.pod
+++ b/cpan/perlfaq/lib/perlfaq3.pod
@@ -4,7 +4,7 @@ perlfaq3 - Programming Tools
=head1 VERSION
-version 5.20200523
+version 5.20201107
=head1 DESCRIPTION
diff --git a/cpan/perlfaq/lib/perlfaq4.pod b/cpan/perlfaq/lib/perlfaq4.pod
index 1a20aba2e7..3645a1489d 100644
--- a/cpan/perlfaq/lib/perlfaq4.pod
+++ b/cpan/perlfaq/lib/perlfaq4.pod
@@ -4,7 +4,7 @@ perlfaq4 - Data Manipulation
=head1 VERSION
-version 5.20200523
+version 5.20201107
=head1 DESCRIPTION
diff --git a/cpan/perlfaq/lib/perlfaq5.pod b/cpan/perlfaq/lib/perlfaq5.pod
index a7fc0eabd1..81a44d804b 100644
--- a/cpan/perlfaq/lib/perlfaq5.pod
+++ b/cpan/perlfaq/lib/perlfaq5.pod
@@ -4,7 +4,7 @@ perlfaq5 - Files and Formats
=head1 VERSION
-version 5.20200523
+version 5.20201107
=head1 DESCRIPTION
diff --git a/cpan/perlfaq/lib/perlfaq6.pod b/cpan/perlfaq/lib/perlfaq6.pod
index 9a45f0e670..6b33321190 100644
--- a/cpan/perlfaq/lib/perlfaq6.pod
+++ b/cpan/perlfaq/lib/perlfaq6.pod
@@ -4,7 +4,7 @@ perlfaq6 - Regular Expressions
=head1 VERSION
-version 5.20200523
+version 5.20201107
=head1 DESCRIPTION
@@ -692,47 +692,34 @@ X<regular expression, efficiency>
(contributed by brian d foy)
-If you have Perl 5.10 or later, this is almost trivial. You just smart
-match against an array of regular expression objects:
-
- my @patterns = ( qr/Fr.d/, qr/B.rn.y/, qr/W.lm./ );
-
- if( $string ~~ @patterns ) {
- ...
- };
-
-The smart match stops when it finds a match, so it doesn't have to try
-every expression.
-
-Earlier than Perl 5.10, you have a bit of work to do. You want to
+You want to
avoid compiling a regular expression every time you want to match it.
In this example, perl must recompile the regular expression for every
-iteration of the C<foreach> loop since it has no way to know what
-C<$pattern> will be:
+iteration of the C<foreach> loop since C<$pattern> can change:
- my @patterns = qw( foo bar baz );
+ my @patterns = qw( fo+ ba[rz] );
- LINE: while( <DATA> ) {
- foreach $pattern ( @patterns ) {
- if( /\b$pattern\b/i ) {
- print;
+ LINE: while( my $line = <> ) {
+ foreach my $pattern ( @patterns ) {
+ if( $line =~ m/\b$pattern\b/i ) {
+ print $line;
next LINE;
}
}
}
-The C<qr//> operator showed up in perl 5.005. It compiles a regular
+The C<qr//> operator compiles a regular
expression, but doesn't apply it. When you use the pre-compiled
version of the regex, perl does less work. In this example, I inserted
a C<map> to turn each pattern into its pre-compiled form. The rest of
the script is the same, but faster:
- my @patterns = map { qr/\b$_\b/i } qw( foo bar baz );
+ my @patterns = map { qr/\b$_\b/i } qw( fo+ ba[rz] );
- LINE: while( <> ) {
- foreach $pattern ( @patterns ) {
- if( /$pattern/ ) {
- print;
+ LINE: while( my $line = <> ) {
+ foreach my $pattern ( @patterns ) {
+ if( $line =~ m/$pattern/ ) {
+ print $line;
next LINE;
}
}
@@ -740,14 +727,18 @@ the script is the same, but faster:
In some cases, you may be able to make several patterns into a single
regular expression. Beware of situations that require backtracking
-though.
+though. In this example, the regex is only compiled once because
+C<$regex> doesn't change between iterations:
- my $regex = join '|', qw( foo bar baz );
+ my $regex = join '|', qw( fo+ ba[rz] );
- LINE: while( <> ) {
- print if /\b(?:$regex)\b/i;
+ while( my $line = <> ) {
+ print if $line =~ m/\b(?:$regex)\b/i;
}
+The function L<Data::Munge/list2re> on CPAN can also be used to form
+a single regex that matches a list of literal strings (not regexes).
+
For more details on regular expression efficiency, see I<Mastering
Regular Expressions> by Jeffrey Friedl. He explains how the regular
expressions engine works and why some patterns are surprisingly
diff --git a/cpan/perlfaq/lib/perlfaq7.pod b/cpan/perlfaq/lib/perlfaq7.pod
index a69e0536f0..0ad703ec90 100644
--- a/cpan/perlfaq/lib/perlfaq7.pod
+++ b/cpan/perlfaq/lib/perlfaq7.pod
@@ -4,7 +4,7 @@ perlfaq7 - General Perl Language Issues
=head1 VERSION
-version 5.20200523
+version 5.20201107
=head1 DESCRIPTION
diff --git a/cpan/perlfaq/lib/perlfaq8.pod b/cpan/perlfaq/lib/perlfaq8.pod
index 8ee088a359..d19235052a 100644
--- a/cpan/perlfaq/lib/perlfaq8.pod
+++ b/cpan/perlfaq/lib/perlfaq8.pod
@@ -4,7 +4,7 @@ perlfaq8 - System Interaction
=head1 VERSION
-version 5.20200523
+version 5.20201107
=head1 DESCRIPTION
diff --git a/cpan/perlfaq/lib/perlfaq9.pod b/cpan/perlfaq/lib/perlfaq9.pod
index 15ca2d03b8..0e23935160 100644
--- a/cpan/perlfaq/lib/perlfaq9.pod
+++ b/cpan/perlfaq/lib/perlfaq9.pod
@@ -4,7 +4,7 @@ perlfaq9 - Web, Email and Networking
=head1 VERSION
-version 5.20200523
+version 5.20201107
=head1 DESCRIPTION
diff --git a/cpan/perlfaq/lib/perlglossary.pod b/cpan/perlfaq/lib/perlglossary.pod
index 2e7eedad3c..d2b54c6fa6 100644
--- a/cpan/perlfaq/lib/perlglossary.pod
+++ b/cpan/perlfaq/lib/perlglossary.pod
@@ -7,7 +7,7 @@ perlglossary - Perl Glossary
=head1 VERSION
-version 5.20200523
+version 5.20201107
=head1 DESCRIPTION
@@ -2642,7 +2642,7 @@ C<tr///>.
Formerly, a reference X<pseudohashes>X<hashes, pseudohashes>to an array
whose initial element happens to hold a reference to a hash. You used to be
able to treat a pseudohash reference as either an array reference or a hash
-reference. Pseduohashes are no longer supported.
+reference. Pseudohashes are no longer supported.
=item pseudoliteral