[win32] merge changes#872,873 from maintbranch
[p5sagit/p5-mst-13.2.git] / pod / perlrun.pod
index 8717349..4bb55bc 100644 (file)
@@ -29,7 +29,8 @@ Specified line by line via B<-e> switches on the command line.
 =item 2.
 
 Contained in the file specified by the first filename on the command line.
-(Note that systems supporting the #! notation invoke interpreters this way.)
+(Note that systems supporting the #! notation invoke interpreters this
+way. See L<Location of Perl>.)
 
 =item 3.
 
@@ -72,7 +73,7 @@ The sequences "-*" and "- " are specifically ignored so that you could,
 if you were so inclined, say
 
     #!/bin/sh -- # -*- perl -*- -p
-    eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
+    eval 'exec /usr/bin/perl -wS $0 ${1+"$@"}'
         if $running_under_some_shell;
 
 to let Perl see the B<-p> switch.
@@ -170,6 +171,19 @@ characters as control characters.
 
 There is no general solution to all of this.  It's just a mess.
 
+=head2 Location of Perl
+
+It may seem obvious to say, but Perl is useful only when users can
+easily find it. When possible, it's good for both B</usr/bin/perl> and
+B</usr/local/bin/perl> to be symlinks to the actual binary. If that
+can't be done, system administrators are strongly encouraged to put
+(symlinks to) perl and its accompanying utilities, such as perldoc, into
+a directory typically found along a user's PATH, or in another obvious
+and convenient place.
+
+In this documentation, C<#!/usr/bin/perl> on the first line of the script
+will stand in for whatever method works on your system.
+
 =head2 Switches
 
 A single-character switch may be combined with the following switch, if
@@ -448,7 +462,7 @@ original name fails, and if the name does not already end in one
 of those suffixes.  If your Perl was compiled with DEBUGGING turned
 on, using the -Dp switch to Perl shows how the search progresses.
 
-If the file supplied contains directory separators (i.e. it is an
+If the filename supplied contains directory separators (i.e. it is an
 absolute or relative pathname), and if the file is not found,
 platforms that append file extensions will do so and try to look
 for the file with those extensions added, one by one.
@@ -463,7 +477,7 @@ don't support #!.  This example works on many platforms that
 have a shell compatible with Bourne shell:
 
     #!/usr/bin/perl
-    eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
+    eval 'exec /usr/bin/perl -wS $0 ${1+"$@"}'
            if $running_under_some_shell;
 
 The system ignores the first line and feeds the script to /bin/sh,
@@ -473,24 +487,27 @@ starts up the Perl interpreter.  On some systems $0 doesn't always
 contain the full pathname, so the B<-S> tells Perl to search for the
 script if necessary.  After Perl locates the script, it parses the
 lines and ignores them because the variable $running_under_some_shell
-is never true.  A better construct than C<$*> would be C<${1+"$@"}>, which
-handles embedded spaces and such in the filenames, but doesn't work if
-the script is being interpreted by csh.  To start up sh rather
+is never true. If the script will be interpreted by csh, you will need
+to replace C<${1+"$@"}> with C<$*>, even though that doesn't understand
+embedded spaces (and such) in the argument list.  To start up sh rather
 than csh, some systems may have to replace the #! line with a line
 containing just a colon, which will be politely ignored by Perl.  Other
 systems can't control that, and need a totally devious construct that
 will work under any of csh, sh, or Perl, such as the following:
 
-       eval '(exit $?0)' && eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
-       & eval 'exec /usr/bin/perl -S $0 $argv:q'
+       eval '(exit $?0)' && eval 'exec /usr/bin/perl -wS $0 ${1+"$@"}'
+       & eval 'exec /usr/bin/perl -wS $0 $argv:q'
                if $running_under_some_shell;
 
 =item B<-T>
 
-forces "taint" checks to be turned on so you can test them.  Ordinarily these checks are
-done only when running setuid or setgid.  It's a good idea to turn
-them on explicitly for programs run on another's behalf, such as CGI
-programs.  See L<perlsec>.
+forces "taint" checks to be turned on so you can test them.  Ordinarily
+these checks are done only when running setuid or setgid.  It's a good
+idea to turn them on explicitly for programs run on another's behalf,
+such as CGI programs.  See L<perlsec>.  Note that (for security reasons)
+this option must be seen by Perl quite early; usually this means it must
+appear early on the command line or in the #! line (for systems which
+support that).
 
 =item B<-u>
 
@@ -619,8 +636,8 @@ look in COMSPEC to find a shell fit for interactive use).
 =item PERL_DEBUG_MSTATS
 
 Relevant only if perl is compiled with the malloc included with the perl
-distribution (that is, if C<perl -V:d_mymalloc> is 'define'),
-if set, this causes memory statistics to be dumped after execution.  If set
+distribution (that is, if C<perl -V:d_mymalloc> is 'define').
+If set, this causes memory statistics to be dumped after execution.  If set
 to an integer greater than one, also causes memory statistics to be dumped
 after compilation.