The useful FAQs and related documents are:
CGI FAQ
- http://www.webthing.com/page.cgi/cgifaq
+ http://www.webthing.com/tutorials/cgifaq.html
Web FAQ
http://www.boutell.com/faq/
=head2 How do I remove HTML from a string?
The most correct way (albeit not the fastest) is to use HTML::Parser
-from CPAN (part of the HTML-Tree package on CPAN). Another correct
+from CPAN. Another mostly correct
way is to use HTML::FormatText which not only removes HTML but also
attempts to do a little simple formatting of the resulting plain text.
Many folks attempt a simple-minded regular expression approach, like
-C<s/E<lt>.*?E<gt>//g>, but that fails in many cases because the tags
+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
entities, like C<<> for example.
=head2 How do I make a pop-up menu in HTML?
-Use the B<E<lt>SELECTE<gt>> and B<E<lt>OPTIONE<gt>> tags. The CGI.pm
+Use the B<< <SELECT> >> and B<< <OPTION> >> tags. The CGI.pm
module (available from CPAN) supports this widget, as well as many
others, including some that it cleverly synthesizes on its own.
# or print HTML from a URL
use LWP::Simple;
- getprint "http://www.sn.no/libwww-perl/";
+ getprint "http://www.linpro.no/lwp/";
# or print ASCII from HTML from a URL
# also need HTML-Tree package from CPAN
$string =~ s/%([a-fA-F0-9]{2})/chr(hex($1))/ge;
Encoding is a bit harder, because you can't just blindly change
-all the non-alphanumunder character (C<\W>) into their hex escapes.
+all characters that are not letters, digits or underscores (C<\W>)
+into their hex escapes.
It's important that characters with special meaning like C</> and C<?>
I<not> be translated. Probably the easiest way to get this right is
to avoid reinventing the wheel and just use the URI::Escape module,
-which is part of the libwww-perl package (LWP) available from CPAN.
+available from CPAN.
=head2 How do I redirect to another page?
=head2 How do I return the user's mail address?
-On systems that support getpwuid, the $E<lt> variable and the
+On systems that support getpwuid, the $< variable and the
Sys::Hostname module (which is part of the standard perl distribution),
you can probably try using something like this: