cvs commit: perlfaq perlfaq2.pod perlfaq3.pod perlfaq5.pod perlfaq6.pod perlfaq8.pod perlfaq9.pod
[email protected] (brian d foy) 22 Apr 2005 19:04:48 -0000
| Newsgroups | perl.cvs.perlfaq |
|---|---|
| Message-ID | <[email protected]> |
cvsuser 05/04/22 12:04:48
Modified: . perlfaq2.pod perlfaq3.pod perlfaq5.pod perlfaq6.pod
perlfaq8.pod perlfaq9.pod
Log:
* Whitespace fixes: no big whoop
Revision Changes Path
1.32 +7 -7 perlfaq/perlfaq2.pod
Index: perlfaq2.pod
===================================================================
RCS file: /cvs/public/perlfaq/perlfaq2.pod,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- perlfaq2.pod 31 Jan 2005 15:54:44 -0000 1.31
+++ perlfaq2.pod 22 Apr 2005 19:04:48 -0000 1.32
@@ -195,7 +195,7 @@
groups are listed at http://lists.perl.org/ ( also known as
http://lists.cpan.org/ ).
-A nice place to ask questions is the PerlMonks site,
+A nice place to ask questions is the PerlMonks site,
http://www.perlmonks.org/ , or the Perl Beginners mailing list
http://lists.perl.org/showlist.cgi?name=beginners .
@@ -219,7 +219,7 @@
=head2 Perl Books
A number of books on Perl and/or CGI programming are available. A few
-of these are good, some are OK, but many aren't worth your money.
+of these are good, some are OK, but many aren't worth your money.
There is a list of these books, some with extensive reviews, at
http://books.perl.org/ .
@@ -385,7 +385,7 @@
by Scott Walters
ISBN 1-59059-395-2 [1st edition December 2004
http://apress.com/book/bookDisplay.html?bID=355
-
+
Mastering Regular Expressions
by Jeffrey E. F. Friedl
ISBN 0-596-00289-0 [2nd edition July 2002]
@@ -420,7 +420,7 @@
Perl Debugger Pocket Reference
by Richard Foley
ISBN 0-596-00503-2 [1st edition January 2004]
- http://www.oreilly.com/catalog/perldebugpr/
+ http://www.oreilly.com/catalog/perldebugpr/
=back
@@ -431,8 +431,8 @@
announcements, contests, and much more. I<TPJ> has columns on web
development, databases, Win32 Perl, graphical programming, regular
expressions, and networking, and sponsors the Obfuscated Perl Contest
-and the Perl Poetry Contests. Beginning in November 2002, TPJ moved to a
-reader-supported monthly e-zine format in which subscribers can download
+and the Perl Poetry Contests. Beginning in November 2002, TPJ moved to a
+reader-supported monthly e-zine format in which subscribers can download
issues as PDF documents. For more details on TPJ, see http://www.tpj.com/
Beyond this, magazines that frequently carry quality articles on
1.48 +5 -5 perlfaq/perlfaq3.pod
Index: perlfaq3.pod
===================================================================
RCS file: /cvs/public/perlfaq/perlfaq3.pod,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -r1.47 -r1.48
--- perlfaq3.pod 27 Mar 2005 07:21:22 -0000 1.47
+++ perlfaq3.pod 22 Apr 2005 19:04:48 -0000 1.48
@@ -225,7 +225,7 @@
=item Eclipse
-The Eclipse Perl Integration Project integrates Perl
+The Eclipse Perl Integration Project integrates Perl
editing/debugging with Eclipse.
The website for the project is http://e-p-i-c.sf.net/
@@ -407,7 +407,7 @@
=item Affrus
-is a full Perl development enivornment with full debugger support
+is a full Perl development enivornment with full debugger support
( http://www.latenightsw.com ).
=item Alpha
@@ -754,10 +754,10 @@
In general, you can't do this. There are some things that may work
for your situation though. People usually ask this question
-because they want to distribute their works without giving away
+because they want to distribute their works without giving away
the source code, and most solutions trade disk space for convenience.
You probably won't see much of a speed increase either, since most
-solutions simply bundle a Perl interpreter in the final product
+solutions simply bundle a Perl interpreter in the final product
(but see L<How can I make my Perl program run faster?>).
The Perl Archive Toolkit (http://par.perl.org/index.cgi) is
1.36 +2 -2 perlfaq/perlfaq5.pod
Index: perlfaq5.pod
===================================================================
RCS file: /cvs/public/perlfaq/perlfaq5.pod,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- perlfaq5.pod 21 Jan 2005 12:26:11 -0000 1.35
+++ perlfaq5.pod 22 Apr 2005 19:04:48 -0000 1.36
@@ -129,7 +129,7 @@
creates an anonymous temporary file.
open my $tmp, '+>', undef or die $!;
-
+
Otherwise, you can use the File::Temp module.
use File::Temp qw/ tempfile tempdir /;
1.32 +15 -15 perlfaq/perlfaq6.pod
Index: perlfaq6.pod
===================================================================
RCS file: /cvs/public/perlfaq/perlfaq6.pod,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- perlfaq6.pod 27 Mar 2005 07:17:28 -0000 1.31
+++ perlfaq6.pod 22 Apr 2005 19:04:48 -0000 1.32
@@ -520,16 +520,16 @@
( contributed by brian d foy )
-Avoid asking Perl to compile a regular expression every time
+Avoid asking Perl to compile a regular expression every time
you want to match it. In this example, perl must recompile
the regular expression for every iteration of the foreach()
loop since it has no way to know what $pattern will be.
@patterns = qw( foo bar baz );
-
- LINE: while( <> )
+
+ LINE: while( <> )
{
- foreach $pattern ( @patterns )
+ foreach $pattern ( @patterns )
{
print if /\b$pattern\b/i;
next LINE;
@@ -545,22 +545,22 @@
@patterns = map { qr/\b$_\b/i } qw( foo bar baz );
- LINE: while( <> )
+ LINE: while( <> )
{
- foreach $pattern ( @patterns )
+ foreach $pattern ( @patterns )
{
print if /\b$pattern\b/i;
next LINE;
}
}
-
+
In some cases, you may be able to make several patterns into
a single regular expression. Beware of situations that require
backtracking though.
$regex = join '|', qw( foo bar baz );
- LINE: while( <> )
+ LINE: while( <> )
{
print if /\b(?:$regex)\b/i;
}
@@ -568,7 +568,7 @@
For more details on regular expression efficiency, see Mastering
Regular Expressions by Jeffrey Freidl. He explains how regular
expressions engine work and why some patterns are surprisingly
-inefficient. Once you understand how perl applies regular
+inefficient. Once you understand how perl applies regular
expressions, you can tune them for individual situations.
=head2 Why don't word-boundary searches with C<\b> work for me?
@@ -601,18 +601,18 @@
"Perl_" # _ is a word char!
"Perler" # no word char before P, but one after l
-
+
You don't have to use \b to match words though. You can look for
non-word characters surrrounded by word characters. These strings
match the pattern /\b'\b/.
"don't" # the ' char is surrounded by "n" and "t"
"qep'a'" # the ' char is surrounded by "p" and "a"
-
+
These strings do not match /\b'\b/.
"foo'" # there is no word char after non-word '
-
+
You can also use the complement of \b, \B, to specify that there
should not be a word boundary.
@@ -621,7 +621,7 @@
"llama" # "am" surrounded by word chars
"Samuel" # same
-
+
These strings do not match /\Bam\B/
"Sam" # no word boundary before "a", but one after "m"
@@ -641,7 +641,7 @@
at will because you've already paid the price. Remember that some
algorithms really appreciate them. As of the 5.005 release, the $&
variable is no longer "expensive" the way the other two are.
-
+
=head2 What good is C<\G> in a regular expression?
You use the C<\G> anchor to start the next match on the same
1.24 +10 -10 perlfaq/perlfaq8.pod
Index: perlfaq8.pod
===================================================================
RCS file: /cvs/public/perlfaq/perlfaq8.pod,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- perlfaq8.pod 3 Jan 2005 18:43:37 -0000 1.23
+++ perlfaq8.pod 22 Apr 2005 19:04:48 -0000 1.24
@@ -413,22 +413,22 @@
Signals are documented in L<perlipc/"Signals"> and the
section on ``Signals'' in the Camel.
-You can set the values of the %SIG hash to be the functions you want
+You can set the values of the %SIG hash to be the functions you want
to handle the signal. After perl catches the signal, it looks in %SIG
for a key with the same name as the signal, then calls the subroutine
value for that key.
# as an anonymous subroutine
-
+
$SIG{INT} = sub { syswrite(STDERR, "ouch\n", 5 ) };
-
+
# or a reference to a function
-
+
$SIG{INT} = \&ouch;
-
+
# or the name of the function as a string
-
- $SIG{INT} = "ouch";
+
+ $SIG{INT} = "ouch";
Perl versions before 5.8 had in its C source code signal handlers which
would catch the signal and possibly run a Perl function that you had set
@@ -1095,12 +1095,12 @@
you need to figure out the problem.
#!/usr/bin/perl -w
-
+
BEGIN {
$SIG{__WARN__} = sub{ print STDERR "Perl: ", @_; };
$SIG{__DIE__} = sub{ print STDERR "Perl: ", @_; exit 1};
}
-
+
$a = 1 + undef;
$x / 0;
__END__
1.21 +8 -8 perlfaq/perlfaq9.pod
Index: perlfaq9.pod
===================================================================
RCS file: /cvs/public/perlfaq/perlfaq9.pod,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- perlfaq9.pod 27 Mar 2005 07:49:59 -0000 1.20
+++ perlfaq9.pod 22 Apr 2005 19:04:48 -0000 1.21
@@ -16,7 +16,7 @@
to Perl, and has its own FAQs and tutorials, and usenet group,
comp.infosystems.www.authoring.cgi
-The CGI specification is outlined in an informational RFC:
+The CGI specification is outlined in an informational RFC:
http://www.ietf.org/rfc/rfc3875
Other relevant documentation listed in: http://www.perl.org/CGI_MetaFAQ.html
@@ -365,19 +365,19 @@
C<param()> function.
use CGI qw(:standard);
-
+
my $total = param( "price" ) + param( "shipping" );
-
+
my @items = param( "item ); # multiple values, same field name
-
+
If you want an object-oriented approach, CGI.pm can do that too.
use CGI;
-
+
my $cgi = CGI->new();
-
+
my $total = $cgi->param( "price" ) + $cgi->param( "shipping" );
-
+
my @items = $cgi->param( "item" );
You might also try CGI::Minimal which is a lightweight version