summaryrefslogtreecommitdiff
path: root/pod/perlfaq3.pod
diff options
context:
space:
mode:
Diffstat (limited to 'pod/perlfaq3.pod')
-rw-r--r--pod/perlfaq3.pod111
1 files changed, 72 insertions, 39 deletions
diff --git a/pod/perlfaq3.pod b/pod/perlfaq3.pod
index 7a307594da..31e669fd5d 100644
--- a/pod/perlfaq3.pod
+++ b/pod/perlfaq3.pod
@@ -13,10 +13,13 @@ Have you looked at CPAN (see L<perlfaq2>)? The chances are that
someone has already written a module that can solve your problem.
Have you read the appropriate man pages? Here's a brief index:
+ Basics perldata, perlvar, perlsyn, perlop, perlsub
+ Execution perlrun, perldebug
+ Functions perlfunc
Objects perlref, perlmod, perlobj, perltie
Data Structures perlref, perllol, perldsc
Modules perlmod, perlmodlib, perlsub
- Regexps perlre, perlfunc, perlop
+ Regexps perlre, perlfunc, perlop, perllocale
Moving to perl5 perltrap, perl
Linking w/C perlxstut, perlxs, perlcall, perlguts, perlembed
Various http://www.perl.com/CPAN/doc/FMTEYEWTK/index.html
@@ -65,8 +68,8 @@ breakdowns of where your code spends its time.
=head2 How do I cross-reference my Perl programs?
The B::Xref module, shipped with the new, alpha-release Perl compiler
-(not the general distribution), can be used to generate
-cross-reference reports for Perl programs.
+(not the general distribution prior to the 5.005 release), can be used
+to generate cross-reference reports for Perl programs.
perl -MO=Xref[,OPTIONS] foo.pl
@@ -99,10 +102,10 @@ the trick.
=head2 Where can I get Perl macros for vi?
For a complete version of Tom Christiansen's vi configuration file,
-see ftp://ftp.perl.com/pub/vi/toms.exrc, the standard benchmark file
-for vi emulators. This runs best with nvi, the current version of vi
-out of Berkeley, which incidentally can be built with an embedded Perl
-interpreter -- see http://www.perl.com/CPAN/src/misc .
+see http://www.perl.com/CPAN/authors/Tom_Christiansen/scripts/toms.exrc,
+the standard benchmark file for vi emulators. This runs best with nvi,
+the current version of vi out of Berkeley, which incidentally can be built
+with an embedded Perl interpreter -- see http://www.perl.com/CPAN/src/misc.
=head2 Where can I get perl-mode for emacs?
@@ -121,25 +124,23 @@ should be using "main::foo", anyway.
=head2 How can I use curses with Perl?
The Curses module from CPAN provides a dynamically loadable object
-module interface to a curses library.
+module interface to a curses library. A small demo can be found at the
+directory http://www.perl.com/CPAN/authors/Tom_Christiansen/scripts/rep;
+this program repeats a command and updates the screen as needed, rendering
+B<rep ps axu> similar to B<top>.
=head2 How can I use X or Tk with Perl?
-Tk is a completely Perl-based, object-oriented interface to the Tk
-toolkit that doesn't force you to use Tcl just to get at Tk. Sx is an
-interface to the Athena Widget set. Both are available from CPAN.
+Tk is a completely Perl-based, object-oriented interface to the Tk toolkit
+that doesn't force you to use Tcl just to get at Tk. Sx is an interface
+to the Athena Widget set. Both are available from CPAN. See the
+directory http://www.perl.com/CPAN/modules/by-category/08_User_Interfaces/
=head2 How can I generate simple menus without using CGI or Tk?
The http://www.perl.com/CPAN/authors/id/SKUNZ/perlmenu.v4.0.tar.gz
module, which is curses-based, can help with this.
-=head2 Can I dynamically load C routines into Perl?
-
-If your system architecture supports it, then the standard perl
-on your system should also provide you with this via the
-DynaLoader module. Read L<perlxstut> for details.
-
=head2 What is undump?
See the next questions.
@@ -225,9 +226,9 @@ No, Perl's garbage collection system takes care of this.
=head2 How can I free an array or hash so my program shrinks?
-You can't. Memory the system allocates to a program will never be
-returned to the system. That's why long-running programs sometimes
-re-exec themselves.
+You can't. Memory the system allocates to a program will in practice
+never be returned to the system. That's why long-running programs
+sometimes re-exec themselves.
However, judicious use of my() on your variables will help make sure
that they go out of scope so that Perl can free up their storage for
@@ -266,6 +267,8 @@ Both of these solutions can have far-reaching effects on your system
and on the way you write your CGI scripts, so investigate them with
care.
+See http://www.perl.com/CPAN/modules/by-category/15_World_Wide_Web_HTML_HTTP_CGI/.
+
=head2 How can I hide the source for my Perl program?
Delete it. :-) Seriously, there are a number of (mostly
@@ -319,9 +322,10 @@ save little more than compilation time, leaving execution no more than
(like several times faster), but this takes some tweaking of your
code.
-Malcolm will be in charge of the 5.005 release of Perl itself
-to try to unify and merge his compiler and multithreading work into
-the main release.
+The 5.005 release of Perl itself, whose main goal is merging the various
+non-Unix ports back into the one Perl source, will also have preliminary
+(strictly beta) support for Malcolm's compiler and his light-weight
+processes (sometimes called "threads").
You'll probably be astonished to learn that the current version of the
compiler generates a compiled form of your script whose executable is
@@ -334,6 +338,16 @@ you link your main perl binary with this, it will make it miniscule.
For example, on one author's system, /usr/bin/perl is only 11k in
size!
+In general, the compiler will do nothing to make a Perl program smaller,
+faster, more portable, or more secure. In fact, it will usually hurt
+all of those. The executable will be bigger, your VM system may take
+longer to load the whole thing, the binary is fragile and hard to fix,
+and compilation never stopped software piracy in the form of crackers,
+viruses, or bootleggers. The real advantage of the compiler is merely
+packaging, and once you see the size of what it makes (well, unless
+you use a shared I<libperl.so>), you'll probably want a complete
+Perl install anywayt.
+
=head2 How can I get '#!perl' to work on [MS-DOS,NT,...]?
For OS/2 just use
@@ -365,12 +379,12 @@ Yes. Read L<perlrun> for more information. Some examples follow.
(These assume standard Unix shell quoting rules.)
# sum first and last fields
- perl -lane 'print $F[0] + $F[-1]'
+ perl -lane 'print $F[0] + $F[-1]' *
# identify text files
perl -le 'for(@ARGV) {print if -f && -T _}' *
- # remove comments from C program
+ # remove (most) comments from C program
perl -0777 -pe 's{/\*.*?\*/}{}gs' foo.c
# make file a month younger than today, defeating reaper daemons
@@ -433,21 +447,28 @@ books. For problems and questions related to the web, like "Why
do I get 500 Errors" or "Why doesn't it run from the browser right
when it runs fine on the command line", see these sources:
- The Idiot's Guide to Solving Perl/CGI Problems, by Tom Christiansen
- http://www.perl.com/perl/faq/idiots-guide.html
+ WWW Security FAQ
+ http://www.w3.org/Security/Faq/
- Frequently Asked Questions about CGI Programming, by Nick Kew
- ftp://rtfm.mit.edu/pub/usenet/news.answers/www/cgi-faq
- http://www3.pair.com/webthing/docs/cgi/faqs/cgifaq.shtml
+ Web FAQ
+ http://www.boutell.com/faq/
- Perl/CGI programming FAQ, by Shishir Gundavaram and Tom Christiansen
- http://www.perl.com/perl/faq/perl-cgi-faq.html
+ CGI FAQ
+ http://www.webthing.com/page.cgi/cgifaq
- The WWW Security FAQ, by Lincoln Stein
- http://www-genome.wi.mit.edu/WWW/faqs/www-security-faq.html
+ HTTP Spec
+ http://www.w3.org/pub/WWW/Protocols/HTTP/
+
+ HTML Spec
+ http://www.w3.org/TR/REC-html40/
+ http://www.w3.org/pub/WWW/MarkUp/
+
+ CGI Spec
+ http://www.w3.org/CGI/
+
+ CGI Security FAQ
+ http://www.go2net.com/people/paulp/cgi-security/safe-cgi.txt
- World Wide Web FAQ, by Thomas Boutell
- http://www.boutell.com/faq/
=head2 Where can I learn about object-oriented Perl programming?
@@ -499,6 +520,18 @@ information, see L<ExtUtils::MakeMaker>.
=head1 AUTHOR AND COPYRIGHT
-Copyright (c) 1997 Tom Christiansen and Nathan Torkington.
-All rights reserved. See L<perlfaq> for distribution information.
-
+Copyright (c) 1997, 1998 Tom Christiansen and Nathan Torkington.
+All rights reserved.
+
+When included as part of the Standard Version of Perl, or as part of
+its complete documentation whether printed or otherwise, this work
+may be distributed only under the terms of Perl's Artistic License.
+Any distribution of this file or derivatives thereof I<outside>
+of that package require that special arrangements be made with
+copyright holder.
+
+Irrespective of its distribution, all code examples in this file
+are hereby placed into the public domain. You are permitted and
+encouraged to use this code in your own programs for fun
+or for profit as you see fit. A simple comment in the code giving
+credit would be courteous but is not required.