FAQ sync
[p5sagit/p5-mst-13.2.git] / pod / perlfaq3.pod
index 40e15de..7dede4c 100644 (file)
@@ -1,6 +1,6 @@
 =head1 NAME
 
-perlfaq3 - Programming Tools ($Revision: 1.33 $, $Date: 2003/01/31 17:34:56 $)
+perlfaq3 - Programming Tools ($Revision: 1.46 $, $Date: 2005/02/13 02:36:09 $)
 
 =head1 DESCRIPTION
 
@@ -49,6 +49,11 @@ expected for normal shell activity and uses Perl syntax and
 functionality for control-flow statements and other things.
 You can get psh at http://www.focusresearch.com/gregor/psh/ .
 
+Zoidberg is a similar project and provides a shell written in perl,
+configured in perl and operated in perl. It is intended as a login shell
+and development environment. It can be found at http://zoidberg.sf.net/
+or your local CPAN mirror.
+
 The Shell.pm module (distributed with Perl) makes Perl try commands
 which aren't part of the Perl language as shell commands.  perlsh
 from the source distribution is simplistic and uninteresting, but
@@ -60,7 +65,7 @@ You can use the ExtUtils::Installed module to show all
 installed distributions, although it can take awhile to do
 its magic.  The standard library which comes with Perl just
 shows up as "Perl" (although you can get those with
-Mod::CoreList).
+Module::CoreList).
 
        use ExtUtils::Installed;
 
@@ -141,10 +146,8 @@ Here's a sample use of Benchmark:
   timethese($count, {
             'map' => sub { my @a = @junk;
                           map { s/a/b/ } @a;
-                          return @a
-                        },
+                          return @a },
             'for' => sub { my @a = @junk;
-                          local $_;
                           for (@a) { s/a/b/ };
                           return @a },
            });
@@ -215,24 +218,24 @@ If you're on Unix, you already have an IDE--Unix itself.  The UNIX
 philosophy is the philosophy of several small tools that each do one
 thing and do it well.  It's like a carpenter's toolbox.
 
-If you want an IDE, check the following:
+If you want an IDE, check the following (in alphabetical order, not
+order of preference):
 
 =over 4
 
-=item Komodo
+=item Eclipse
 
-ActiveState's cross-platform (as of April 2001 Windows and Linux),
-multi-language IDE has Perl support, including a regular expression
-debugger and remote debugging
-( http://www.ActiveState.com/Products/Komodo/index.html ).  (Visual
-Perl, a Visual Studio.NET plug-in is currently (early 2001) in beta
-( http://www.ActiveState.com/Products/VisualPerl/index.html )).
+The Eclipse Perl Integration Project integrates Perl 
+editing/debugging with Eclipse.
 
-=item The Object System
+The website for the project is http://e-p-i-c.sf.net/
 
-( http://www.castlelink.co.uk/object_system/ ) is a Perl web
-applications development IDE, apparently for any platform
-that runs Perl.
+=item Komodo
+
+ActiveState's cross-platform (as of October 2004, that's Windows, Linux,
+and Solaris), multi-language IDE has Perl support, including a regular expression
+debugger and remote debugging
+( http://www.ActiveState.com/Products/Komodo/ ).
 
 =item Open Perl IDE
 
@@ -241,6 +244,11 @@ Open Perl IDE is an integrated development environment for writing
 and debugging Perl scripts with ActiveState's ActivePerl distribution
 under Windows 95/98/NT/2000.
 
+=item OptiPerl
+
+( http://www.optiperl.com/ ) is a Windows IDE with simulated CGI
+environment, including debugger and syntax highlighting editor.
+
 =item PerlBuilder
 
 ( http://www.solutionsoft.com/perl.htm ) is an integrated development
@@ -251,10 +259,11 @@ environment for Windows that supports Perl development.
 ( http://helpconsulting.net/visiperl/ )
 From Help Consulting, for Windows.
 
-=item OptiPerl
+=item Visual Perl
+
+( http://www.activestate.com/Products/Visual_Perl/ )
+Visual Perl is a Visual Studio.NET plug-in from ActiveState.
 
-( http://www.optiperl.com/ ) is a Windows IDE with simulated CGI
-environment, including debugger and syntax highlighting editor.
 
 =back
 
@@ -276,7 +285,7 @@ specifically for programming, such as Textpad
 If you are using MacOS, the same concerns apply.  MacPerl
 (for Classic environments) comes with a simple editor.
 Popular external editors are BBEdit ( http://www.bbedit.com/ )
-or Alpha ( http://www.kelehers.org/alpha/ ). MacOS X users can
+or Alpha ( http://www.his.com/~jguyer/Alpha/Alpha8.html ). MacOS X users can
 use Unix editors as well.
 
 =over 4
@@ -335,7 +344,7 @@ The following are Win32 multilanguage editor/IDESs that support Perl:
 
 =item Codewright
 
-http://www.starbase.com/
+http://www.borland.com/codewright/
 
 =item MultiEdit
 
@@ -396,16 +405,22 @@ no 32k limit).
 
 =over 4
 
-=item BBEdit and BBEdit Lite
+=item Affrus
 
-are text editors for Mac OS that have a Perl sensitivity mode
-( http://web.barebones.com/ ).
+is a full Perl development enivornment with full debugger support 
+( http://www.latenightsw.com ).
 
 =item Alpha
 
 is an editor, written and extensible in Tcl, that nonetheless has
 built in support for several popular markup and programming languages
-including Perl and HTML ( http://alpha.olm.net/ ).
+including Perl and HTML ( http://www.his.com/~jguyer/Alpha/Alpha8.html ).
+
+=item BBEdit and BBEdit Lite
+
+are text editors for Mac OS that have a Perl sensitivity mode
+( http://web.barebones.com/ ).
+
 
 =back
 
@@ -451,7 +466,7 @@ to the Athena Widget set.  Both are available from CPAN.  See the
 directory http://www.cpan.org/modules/by-category/08_User_Interfaces/
 
 Invaluable for Perl/Tk programming are the Perl/Tk FAQ at
-http://w4.lns.cornell.edu/%7Epvhp/ptk/ptkTOC.html , the Perl/Tk Reference
+http://phaseit.net/claird/comp.lang.perl.tk/ptkFAQ.html , the Perl/Tk Reference
 Guide available at
 http://www.cpan.org/authors/Stephen_O_Lidie/ , and the
 online manpages at
@@ -634,23 +649,25 @@ everything works out right.
 
 =head2 How can I free an array or hash so my program shrinks?
 
-You usually can't. On most operating systems, memory
-allocated to a program can never be returned to the system.
-That's why long-running programs sometimes re-exec
-themselves. Some operating systems (notably, systems that
-use mmap(2) for allocating large chunks of memory) can
-reclaim memory that is no longer used, but on such systems,
-perl must be configured and compiled to use the OS's malloc,
-not perl's.
-
-However, judicious use of my() on your variables will help make sure
-that they go out of scope so that Perl can free up that space for
-use in other parts of your program.  A global variable, of course, never
-goes out of scope, so you can't get its space automatically reclaimed,
-although undef()ing and/or delete()ing it will achieve the same effect.
+(contributed by Michael Carman)
+
+You usually can't. Memory allocated to lexicals (i.e. my() variables)
+cannot be reclaimed or reused even if they go out of scope. It is
+reserved in case the variables come back into scope. Memory allocated
+to global variables can be reused (within your program) by using
+undef()ing and/or delete().
+
+On most operating systems, memory allocated to a program can never be
+returned to the system. That's why long-running programs sometimes re-
+exec themselves. Some operating systems (notably, systems that use
+mmap(2) for allocating large chunks of memory) can reclaim memory that
+is no longer used, but on such systems, perl must be configured and
+compiled to use the OS's malloc, not perl's.
+
 In general, memory allocation and de-allocation isn't something you can
-or should be worrying about much in Perl, but even this capability
-(preallocation of data types) is in the works.
+or should be worrying about much in Perl.
+
+See also "How can I make my Perl program take less memory?"
 
 =head2 How can I make my CGI script more efficient?
 
@@ -738,46 +755,45 @@ you want to be sure your license's wording will stand up in court.
 
 =head2 How can I compile my Perl program into byte code or C?
 
-Malcolm Beattie has written a multifunction backend compiler,
-available from CPAN, that can do both these things.  It is included
-in the perl5.005 release, but is still considered experimental.
-This means it's fun to play with if you're a programmer but not
-really for people looking for turn-key solutions.
-
-Merely compiling into C does not in and of itself guarantee that your
-code will run very much faster.  That's because except for lucky cases
-where a lot of native type inferencing is possible, the normal Perl
-run-time system is still present and so your program will take just as
-long to run and be just as big.  Most programs save little more than
-compilation time, leaving execution no more than 10-30% faster.  A few
-rare programs actually benefit significantly (even running several times
-faster), but this takes some tweaking of your code.
-
-You'll probably be astonished to learn that the current version of the
-compiler generates a compiled form of your script whose executable is
-just as big as the original perl executable, and then some.  That's
-because as currently written, all programs are prepared for a full
-eval() statement.  You can tremendously reduce this cost by building a
-shared I<libperl.so> library and linking against that.  See the
-F<INSTALL> podfile in the Perl source distribution for details.  If
-you link your main perl binary with this, it will make it minuscule.
-For example, on one author's system, F</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 can make your
-situation worse.  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 anyway.
+(contributed by brian d foy)
+
+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 
+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 
+(but see L<How can I make my Perl program run faster?>).
+
+The Perl Archive Toolkit (http://par.perl.org/index.cgi) is
+Perl's analog to Java's JAR.  It's freely available and on
+CPAN (http://search.cpan.org/dist/PAR/).
+
+The B::* namespace, often called "the Perl compiler", but is really a
+way for Perl programs to peek at its innards rather than create
+pre-compiled versions of your program.  However. the B::Bytecode
+module can turn your script  into a bytecode format that could be
+loaded later by the ByteLoader module and executed as a regular Perl
+script.
+
+There are also some commercial products that may work for
+you, although you have to buy a license for them.
+
+The Perl Dev Kit
+(http://www.activestate.com/Products/Perl_Dev_Kit/) from
+ActiveState can "Turn your Perl programs into ready-to-run
+executables for HP-UX, Linux, Solaris and Windows."
+
+Perl2Exe (http://www.indigostar.com/perl2exe.htm) is a
+command line program for converting perl scripts to
+executable files.  It targets both Windows and unix
+platforms.
+
 
 =head2 How can I compile Perl into Java?
 
 You can also integrate Java and Perl with the
-Perl Resource Kit from O'Reilly and Associates.  See
+Perl Resource Kit from O'Reilly Media.  See
 http://www.oreilly.com/catalog/prkunix/ .
 
 Perl 5.6 comes with Java Perl Lingo, or JPL.  JPL, still in
@@ -792,8 +808,8 @@ For OS/2 just use
 
 as the first line in C<*.cmd> file (C<-S> due to a bug in cmd.exe's
 `extproc' handling).  For DOS one should first invent a corresponding
-batch file and codify it in C<ALTERNATIVE_SHEBANG> (see the
-F<INSTALL> file in the source distribution for more information).
+batch file and codify it in C<ALTERNATE_SHEBANG> (see the
+F<dosish.h> file in the source distribution for more information).
 
 The Win95/NT installation, when using the ActiveState port of Perl,
 will modify the Registry to associate the C<.pl> extension with the
@@ -804,8 +820,10 @@ the Registry yourself.  In addition to associating C<.pl> with the
 interpreter, NT people can use: C<SET PATHEXT=%PATHEXT%;.PL> to let them
 run the program C<install-linux.pl> merely by typing C<install-linux>.
 
-Macintosh Perl programs will have the appropriate Creator and
-Type, so that double-clicking them will invoke the Perl application.
+Under "Classic" MacOS, a perl program will have the appropriate Creator and
+Type, so that double-clicking them will invoke the MacPerl application.
+Under Mac OS X, clickable apps can be made from any C<#!> script using Wil
+Sanchez' DropScript utility: http://www.wsanchez.net/software/ .
 
 I<IMPORTANT!>: Whatever you do, PLEASE don't get frustrated, and just
 throw the perl interpreter into your cgi-bin directory, in order to
@@ -914,8 +932,7 @@ L<perlguts>.  Don't forget that you can learn a lot from looking at
 how the authors of existing extension modules wrote their code and
 solved their problems.
 
-=head2 I've read perlembed, perlguts, etc., but I can't embed perl in
-my C program; what am I doing wrong?
+=head2 I've read perlembed, perlguts, etc., but I can't embed perl in my C program; what am I doing wrong?
 
 Download the ExtUtils::Embed kit from CPAN and run `make test'.  If
 the tests pass, read the pods again and again and again.  If they
@@ -947,8 +964,8 @@ information, see L<ExtUtils::MakeMaker>.
 
 =head1 AUTHOR AND COPYRIGHT
 
-Copyright (c) 1997-2002 Tom Christiansen and Nathan Torkington.
-All rights reserved.
+Copyright (c) 1997-2005 Tom Christiansen, Nathan Torkington, and
+other authors as noted. All rights reserved.
 
 This documentation is free; you can redistribute it and/or modify it
 under the same terms as Perl itself.