Force RVALUE macros when in PERL_DEBUG_COW
[p5sagit/p5-mst-13.2.git] / pod / perlrun.pod
index 551bbcb..9ff9ac9 100644 (file)
@@ -6,7 +6,7 @@ perlrun - how to execute the Perl interpreter
 
 B<perl>        S<[ B<-sTtuUWX> ]>
        S<[ B<-hv> ] [ B<-V>[:I<configvar>] ]>
-       S<[ B<-cw> ] [ B<-d>[:I<debugger>] ] [ B<-D>[I<number/list>] ]>
+       S<[ B<-cw> ] [ B<-d>[B<t>][:I<debugger>] ] [ B<-D>[I<number/list>] ]>
        S<[ B<-pna> ] [ B<-F>I<pattern> ] [ B<-l>[I<octal>] ] [ B<-0>[I<octal/hexadecimal>] ]>
        S<[ B<-I>I<dir> ] [ B<-m>[B<->]I<module> ] [ B<-M>[B<->]I<'module...'> ]>
        S<[ B<-P> ]>
@@ -141,8 +141,10 @@ Perl program and a Perl library file.
 
 =item Macintosh
 
-A Macintosh perl program 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/ .
 
 =item VMS
 
@@ -342,16 +344,24 @@ be skipped.
 
 =item B<-d>
 
+=item B<-dt>
+
 runs the program under the Perl debugger.  See L<perldebug>.
+If B<t> is specified, it indicates to the debugger that threads
+will be used in the code being debugged.
 
 =item B<-d:>I<foo[=bar,baz]>
 
+=item B<-dt:>I<foo[=bar,baz]>
+
 runs the program under the control of a debugging, profiling, or
 tracing module installed as Devel::foo. E.g., B<-d:DProf> executes
 the program using the Devel::DProf profiler.  As with the B<-M>
 flag, options may be passed to the Devel::foo package where they
 will be received and interpreted by the Devel::foo::import routine.
 The comma-separated list of options must follow a C<=> character.
+If B<t> is specified, it indicates to the debugger that threads
+will be used in the code being debugged.
 See L<perldebug>.
 
 =item B<-D>I<letters>
@@ -367,9 +377,8 @@ the format of the output is explained in L<perldebguts>.
 As an alternative, specify a number instead of list of letters (e.g.,
 B<-D14> is equivalent to B<-Dtls>):
 
-        1  p  Tokenizing and parsing
-        2  s  Stack snapshots
-                with v, displays all stacks
+        1  p  Tokenizing and parsing (with v, displays parse stack)
+        2  s  Stack snapshots (with v, displays all stacks)
         4  l  Context (loop) stack processing
         8  t  Trace execution
        16  o  Method and overloading resolution
@@ -391,7 +400,7 @@ B<-D14> is equivalent to B<-Dtls>):
   1048576  v  Verbose: use in conjunction with other flags
   2097152  C  Copy On Write
   4194304  A  Consistency checks on internal structures
-  8388608  q  quiet - currently only suppressed the "EXECUTING" message
+  8388608  q  quiet - currently only suppresses the "EXECUTING" message
 
 All these flags require B<-DDEBUGGING> when you compile the Perl
 executable (but see L<Devel::Peek>, L<re> which may change this).
@@ -404,7 +413,7 @@ as it executes, the way that C<sh -x> provides for shell scripts,
 you can't use Perl's B<-D> switch.  Instead do this
 
   # If you have "env" utility
-  env=PERLDB_OPTS="NonStop=1 AutoTrace=1 frame=2" perl -dS program
+  env PERLDB_OPTS="NonStop=1 AutoTrace=1 frame=2" perl -dS program
 
   # Bourne shell syntax
   $ PERLDB_OPTS="NonStop=1 AutoTrace=1 frame=2" perl -dS program
@@ -421,6 +430,17 @@ will not look for a filename in the argument list.  Multiple B<-e>
 commands may be given to build up a multi-line script.  Make sure
 to use semicolons where you would in a normal program.
 
+=item B<-f>
+
+Disable executing F<$Config{siteperl}/sitecustomize.pl> at
+startup.
+
+Perl can be built so that it by default will try to execute
+F<$Config{siteperl}/sitecustomize.pl> at startup.  This is a hook that
+allows the sysadmin to customize how perl behaves.  It can for
+instance be used to add entries to the @INC array to make perl find
+modules in non-standard locations.
+
 =item B<-F>I<pattern>
 
 specifies the pattern to split on if B<-a> is also in effect.  The
@@ -533,6 +553,10 @@ folks use it for their backup files:
 
     $ perl -pi~ -e 's/foo/bar/' file1 file2 file3...
 
+Note that because B<-i> renames or deletes the original file before
+creating a new file of the same name, UNIX-style soft and hard links will
+not be preserved.
+
 Finally, the B<-i> switch does not impede execution when no
 files are given on the command line.  In this case, no backup is made
 (the original file cannot, of course, be determined) and processing
@@ -605,7 +629,7 @@ Note that the lines are not printed by default.  See B<-p> to have
 lines printed.  If a file named by an argument cannot be opened for
 some reason, Perl warns you about it and moves on to the next file.
 
-Here is an efficient way to delete all files that haven't been modifed for
+Here is an efficient way to delete all files that haven't been modified for
 at least a week:
 
     find . -mtime +7 -print | perl -nle unlink
@@ -719,7 +743,8 @@ if it is invoked with B<-xyz=abc>.
     if ($xyz) { print "$xyz\n" }
 
 Do note that B<--help> creates the variable ${-help}, which is not compliant
-with C<strict refs>.
+with C<strict refs>.  Also, when using this option on a script with
+warnings enabled you may get a lot of spurious "used only once" warnings.
 
 =item B<-S>
 
@@ -733,9 +758,12 @@ 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.
 
-Typically this is used to emulate #! startup on platforms that
-don't support #!.  This example works on many platforms that
-have a shell compatible with Bourne shell:
+Typically this is used to emulate #! startup on platforms that don't
+support #!.  Its also convenient when debugging a script that uses #!,
+and is thus normally found by the shell's $PATH search mechanism.
+
+This example works on many platforms that have a shell compatible with
+Bourne shell:
 
     #!/usr/bin/perl
     eval 'exec /usr/bin/perl -wS $0 ${1+"$@"}'
@@ -827,15 +855,45 @@ prints the version and patchlevel of your perl executable.
 prints summary of the major perl configuration values and the current
 values of @INC.
 
-=item B<-V:>I<name>
+=item B<-V:>I<configvar>
+
+Prints to STDOUT the value of the named configuration variable(s),
+with multiples when your configvar argument looks like a regex (has
+non-letters).  For example:
+
+    $ perl -V:libc
+       libc='/lib/libc-2.2.4.so';
+    $ perl -V:lib.
+       libs='-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc';
+       libc='/lib/libc-2.2.4.so';
+    $ perl -V:lib.*
+       libpth='/usr/local/lib /lib /usr/lib';
+       libs='-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc';
+       lib_ext='.a';
+       libc='/lib/libc-2.2.4.so';
+       libperl='libperl.a';
+       ....
 
-Prints to STDOUT the value of the named configuration variable.
-For example,
+Additionally, extra colons can be used to control formatting.  A
+trailing colon suppresses the linefeed and terminator ';', allowing
+you to embed queries into shell commands.  (mnemonic: PATH separator
+':'.)
 
-    $ perl -V:man.dir
+    $ echo "compression-vars: " `perl -V:z.*: ` " are here !"
+    compression-vars:  zcat='' zip='zip'  are here !
 
-will provide strong clues about what your MANPATH variable should
-be set to in order to access the Perl documentation.
+A leading colon removes the 'name=' part of the response, this allows
+you to map to the name you need.  (mnemonic: empty label)
+
+    $ echo "goodvfork="`./perl -Ilib -V::usevfork`
+    goodvfork=false;
+
+Leading and trailing colons can be used together if you need
+positional parameter values without the names.  Note that in the case
+below, the PERL_API params are returned in alphabetical order.
+
+    $ echo building_on `perl -V::osname: -V::PERL_API_.*:` now
+    building_on 'linux' '5' '1' '9' now
 
 =item B<-w>
 
@@ -864,6 +922,8 @@ See L<perllexwarn>.
 Disables all warnings regardless of C<use warnings> or C<$^W>.
 See L<perllexwarn>.
 
+=item B<-x>
+
 =item B<-x> I<directory>
 
 tells Perl that the program is embedded in a larger chunk of unrelated
@@ -975,7 +1035,7 @@ Use with the same care as is reserved for nitroglycerin.
 
 =item :raw
 
-A pseudolayer that manipulates other layers.  Applying the <:raw>
+A pseudolayer that manipulates other layers.  Applying the C<:raw>
 layer is equivalent to calling C<binmode($fh)>.  It makes the stream
 pass each byte as-is without any translation.  In particular CRLF
 translation, and/or :utf8 intuited from locale are disabled.
@@ -1044,6 +1104,8 @@ and Win32 approximate equivalent:
    set PERLIO_DEBUG=CON
    perl script ...
 
+This functionality is disabled for setuid scripts and for scripts run
+with B<-T>.
 
 =item PERLLIB
 
@@ -1057,6 +1119,11 @@ The command used to load the debugger code.  The default is:
 
        BEGIN { require 'perl5db.pl' }
 
+=item PERL5DB_THREADED
+
+If set to a true value, indicates to the debugger that the code being
+debugged uses threads.
+
 =item PERL5SHELL (specific to the Win32 port)
 
 May be set to an alternative shell that perl must use internally for
@@ -1072,6 +1139,20 @@ fit for interactive use, and setting COMSPEC to such a shell may
 interfere with the proper functioning of other programs (which usually
 look in COMSPEC to find a shell fit for interactive use).
 
+=item PERL_ALLOW_NON_IFS_LSP (specific to the Win32 port)
+
+Set to 1 to allow the use of non-IFS compatible LSP's.
+Perl normally searches for an IFS-compatible LSP because this is required
+for its emulation of Windows sockets as real filehandles.  However, this may
+cause problems if you have a firewall such as McAfee Guardian which requires
+all applications to use its LSP which is not IFS-compatible, because clearly
+Perl will normally avoid using such an LSP.
+Setting this environment variable to 1 means that Perl will simply use the
+first suitable LSP enumerated in the catalog, which keeps McAfee Guardian
+happy (and in that particular case Perl still works too because McAfee
+Guardian's LSP actually plays some other games which allow applications
+requiring IFS compatibility to work).
+
 =item PERL_DEBUG_MSTATS
 
 Relevant only if perl is compiled with the malloc included with the perl
@@ -1150,7 +1231,7 @@ L<perlvms> and in F<README.vms> in the Perl source distribution.
 In Perls 5.8.1 and later.  If set to C<unsafe> the pre-Perl-5.8.0
 signals behaviour (immediate but unsafe) is restored.  If set to
 C<safe> the safe (or deferred) signals are used.
-See L<perlipc/"Deferred Signals (Safe signals)">.
+See L<perlipc/"Deferred Signals (Safe Signals)">.
 
 =item PERL_UNICODE