From: Father Chrysostomos Date: Sun, 20 Feb 2011 01:40:37 +0000 (-0800) Subject: Minor perlfaq9 tweaks X-Git-Tag: accepted/trunk/20130322.191538~5430 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=42993a5c4912d5546ce7c95cae4169e1e613106c;p=platform%2Fupstream%2Fperl.git Minor perlfaq9 tweaks --- diff --git a/pod/perlfaq9.pod b/pod/perlfaq9.pod index 41de7e8..d00d918 100644 --- a/pod/perlfaq9.pod +++ b/pod/perlfaq9.pod @@ -36,7 +36,7 @@ job to create an accurate HTTP response based on it). So "\n" written in text mode is technically correct, and recommended. NPH scripts are more tricky: they must put out a complete and accurate set of HTTP transaction response headers; the HTTP specification calls for records -to be terminated with carriage-return and line-feed, i.e ASCII \015\012 +to be terminated with carriage-return and line-feed; i.e., ASCII \015\012 written in binary mode. Using C gives excellent platform independence, including EBCDIC @@ -56,7 +56,7 @@ guide on Perlmonks: =head2 How can I get better error messages from a CGI program? Use the C module. It replaces C and C, plus the -normal C modules C, C, and C functions with +normal C module's C, C, and C functions with more verbose and safer versions. It still sends them to the normal server error log. @@ -96,7 +96,7 @@ attempts to do a little simple formatting of the resulting plain text. Many folks attempt a simple-minded regular expression approach, like C<< s/<.*?>//g >>, but that fails in many cases because the tags may continue over line breaks, they may contain quoted angle-brackets, -or HTML comment may be present. Plus, folks forget to convert +or HTML comments may be present. Plus, folks forget to convert entities--like C<<> for example. Here's one "simple-minded" approach, that works for most files: @@ -147,7 +147,7 @@ You can use C to extract URLs from an arbitrary text document. Less complete solutions involving regular expressions can save you a lot of processing time if you know that the input is simple. One solution from Tom Christiansen runs 100 times faster than most -module based approaches but only extracts URLs from anchors where the first +module-based approaches but only extracts URLs from anchors where the first attribute is HREF and there are no other attributes. #!/usr/bin/perl -n00