Hash lookup of constant strings optimization:
[p5sagit/p5-mst-13.2.git] / pod / perlfaq8.pod
index d35a3b3..0ac4620 100644 (file)
@@ -1,6 +1,6 @@
 =head1 NAME
 
-perlfaq8 - System Interaction ($Revision: 1.36 $, $Date: 1999/01/08 05:36:34 $)
+perlfaq8 - System Interaction ($Revision: 1.39 $, $Date: 1999/05/23 18:37:57 $)
 
 =head1 DESCRIPTION
 
@@ -15,8 +15,9 @@ contain more detailed information on the vagaries of your perl.
 
 =head2 How do I find out which operating system I'm running under?
 
-The $^O variable ($OSNAME if you use English) contains the operating
-system that your perl binary was built for.
+The $^O variable ($OSNAME if you use English) contains an indication of
+the name of the operating system (not its release number) that your perl
+binary was built for.
 
 =head2 How come exec() doesn't return?
 
@@ -74,7 +75,7 @@ Or like this:
 =head2 How do I read just one key without waiting for a return key?
 
 Controlling input buffering is a remarkably system-dependent matter.
-If most systems, you can just use the B<stty> command as shown in
+On many systems, you can just use the B<stty> command as shown in
 L<perlfunc/getc>, but as you see, that's already getting you into
 portability snags.  
 
@@ -167,7 +168,7 @@ not to block:
 
 =head2 How do I clear the screen?
 
-If you only have to so infrequently, use C<system>:
+If you only have do so infrequently, use C<system>:
 
     system("clear");
 
@@ -409,7 +410,7 @@ For example:
     }
 
 However, because syscalls restart by default, you'll find that if
-you're in a "slow" call, such as E<lt>FHE<gt>, read(), connect(), or
+you're in a "slow" call, such as <FH>, read(), connect(), or
 wait(), that the only way to terminate them is by "longjumping" out;
 that is, by raising an exception.  See the time-out handler for a
 blocking flock() in L<perlipc/"Signals"> or chapter 6 of the Camel.
@@ -421,7 +422,7 @@ properly, the getpw*() functions described in L<perlfunc> should in
 theory provide (read-only) access to entries in the shadow password
 file.  To change the file, make a new shadow password file (the format
 varies from system to system - see L<passwd(5)> for specifics) and use
-pwd_mkdb(8) to install it (see L<pwd_mkdb(5)> for more details).
+pwd_mkdb(8) to install it (see L<pwd_mkdb(8)> for more details).
 
 =head2 How do I set the time and date?
 
@@ -442,9 +443,8 @@ probably get away with setting an environment variable:
 
 If you want finer granularity than the 1 second that the sleep()
 function provides, the easiest way is to use the select() function as
-documented in L<perlfunc/"select">.  If your system has itimers and
-syscall() support, you can check out the old example in
-http://www.perl.com/CPAN/doc/misc/ancient/tutorial/eg/itimers.pl .
+documented in L<perlfunc/"select">.  Try the Time::HiRes and
+the BSD::Itimer modules (available from CPAN).
 
 =head2 How can I measure time under a second?
 
@@ -461,7 +461,7 @@ something like this:
 
     $done = $start = pack($TIMEVAL_T, ());
 
-    syscall( &SYS_gettimeofday, $start, 0) != -1
+    syscall(&SYS_gettimeofday, $start, 0) != -1
                or die "gettimeofday: $!";
 
        ##########################
@@ -699,7 +699,7 @@ case the fork()/exec() description still applies.
 
 Strictly speaking, nothing.  Stylistically speaking, it's not a good
 way to write maintainable code because backticks have a (potentially
-humungous) return value, and you're ignoring it.  It's may also not be very
+humongous) return value, and you're ignoring it.  It's may also not be very
 efficient, because you have to read in all the lines of output, allocate
 memory for them, and then throw it away.  Too often people are lulled
 to writing:
@@ -725,7 +725,7 @@ In most cases, this could and probably should be written as
     system("cat /etc/termcap") == 0
        or die "cat program failed!";
 
-Which will get the output quickly (as its generated, instead of only
+Which will get the output quickly (as it is generated, instead of only
 at the end) and also check the return value.
 
 system() also provides direct control over whether shell wildcard
@@ -751,8 +751,14 @@ You have to do this:
     }
 
 Just as with system(), no shell escapes happen when you exec() a list.
+Further examples of this can be found in L<perlipc/"Safe Pipe Opens">.
 
-There are more examples of this L<perlipc/"Safe Pipe Opens">.
+Note that if you're stuck on Microsoft, no solution to this vexing issue
+is even possible.  Even if Perl were to emulate fork(), you'd still
+be hosed, because Microsoft gives no argc/argv-style API.  Their API
+always reparses from a single string, which is fundamentally wrong,
+but you're not likely to get the Gods of Redmond to acknowledge this
+and fix it for you.
 
 =head2 Why can't my script read from STDIN after I gave it EOF (^D on Unix, ^Z on MS-DOS)?
 
@@ -899,10 +905,6 @@ Background yourself like this:
 The Proc::Daemon module, available from CPAN, provides a function to
 perform these actions for you.
 
-=head2 How do I make my program run with sh and csh?
-
-See the F<eg/nih> script (part of the perl source distribution).
-
 =head2 How do I find out if I'm running interactively or not?
 
 Good question.  Sometimes C<-t STDIN> and C<-t STDOUT> can give clues,
@@ -928,7 +930,7 @@ the current process group of your controlling terminal as follows:
 =head2 How do I timeout a slow event?
 
 Use the alarm() function, probably in conjunction with a signal
-handler, as documented L<perlipc/"Signals"> and chapter 6 of the
+handler, as documented in L<perlipc/"Signals"> and chapter 6 of the
 Camel.  You may instead use the more flexible Sys::AlarmCall module
 available from CPAN.
 
@@ -945,10 +947,9 @@ in L<perlfunc/fork>.
 =head2 How do I use an SQL database?
 
 There are a number of excellent interfaces to SQL databases.  See the
-DBD::* modules available from
-http://www.perl.com/CPAN/modules/dbperl/DBD .
+DBD::* modules available from http://www.perl.com/CPAN/modules/DBD .
 A lot of information on this can be found at 
-http://www.hermetica.com/technologia/perl/DBI/index.html .
+http://www.symbolstone.org/technology/perl/DBI/
 
 =head2 How do I make a system() exit on control-C?
 
@@ -970,12 +971,15 @@ sysopen():
     sysopen(FH, "/tmp/somefile", O_WRONLY|O_NDELAY|O_CREAT, 0644)
         or die "can't open /tmp/somefile: $!":
 
-=head2 How do I install a CPAN module?
 
-The easiest way is to have the CPAN module do it for you.  This module
-comes with perl version 5.004 and later.  To manually install the CPAN
-module, or any well-behaved CPAN module for that matter, follow these
-steps:
+
+
+=head2 How do I install a module from CPAN?
+
+The easiest way is to have a module also named CPAN do it for you.
+This module comes with perl version 5.004 and later.  To manually install
+the CPAN module, or any well-behaved CPAN module for that matter, follow
+these steps:
 
 =over 4
 
@@ -1064,7 +1068,7 @@ Here are the suggested ways of modifying your include path:
 
     the PERLLIB environment variable
     the PERL5LIB environment variable
-    the perl -Idir commpand line flag
+    the perl -Idir command line flag
     the use lib pragma, as in
         use lib "$ENV{HOME}/myown_perllib";
 
@@ -1095,4 +1099,3 @@ 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.
-