From: Rafael Garcia-Suarez Date: Thu, 30 Jan 2003 20:52:05 +0000 (+0000) Subject: FAQ sync. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=04d666b12563dfde61714b0a22a39c0eb94d4f16;p=p5sagit%2Fp5-mst-13.2.git FAQ sync. p4raw-id: //depot/perl@18604 --- diff --git a/pod/perlfaq.pod b/pod/perlfaq.pod index 73f12e7..cc2c185 100644 --- a/pod/perlfaq.pod +++ b/pod/perlfaq.pod @@ -1,6 +1,6 @@ =head1 NAME -perlfaq - frequently asked questions about Perl ($Date: 2003/01/03 20:00:25 $) +perlfaq - frequently asked questions about Perl ($Date: 2003/01/26 17:45:46 $) =head1 DESCRIPTION @@ -516,7 +516,7 @@ What's wrong with always quoting "$vars"? =item * -Why don't my <EHERE documents work? =item * @@ -733,7 +733,7 @@ How come when I open a file read-write it wipes it out? =item * -Why do I sometimes get an "Argument list too long" when I use <*>? +Why do I sometimes get an "Argument list too long" when I use E*E? =item * @@ -753,7 +753,7 @@ How can I lock a file? =item * -Why can't I just open(FH, ">file.lock")? +Why can't I just open(FH, "Efile.lock")? =item * @@ -1012,7 +1012,7 @@ What's the difference between deep and shallow binding? =item * -Why doesn't "my($foo) = ;" work right? +Why doesn't "my($foo) = EFILEE;" work right? =item * diff --git a/pod/perlfaq2.pod b/pod/perlfaq2.pod index 22f7ad7..45738ab 100644 --- a/pod/perlfaq2.pod +++ b/pod/perlfaq2.pod @@ -1,6 +1,6 @@ =head1 NAME -perlfaq2 - Obtaining and Learning about Perl ($Revision: 1.18 $, $Date: 2002/12/06 07:40:11 $) +perlfaq2 - Obtaining and Learning about Perl ($Revision: 1.20 $, $Date: 2003/01/26 17:50:56 $) =head1 DESCRIPTION @@ -171,24 +171,33 @@ assistance: =head2 What are the Perl newsgroups on Usenet? Where do I post questions? -The now defunct comp.lang.perl newsgroup has been superseded by the -following groups: +Several groups devoted to the Perl language are on Usenet: comp.lang.perl.announce Moderated announcement group - comp.lang.perl.misc Very busy group about Perl in general - comp.lang.perl.moderated Moderated discussion group + comp.lang.perl.misc High traffic general Perl discussion + comp.lang.perl.moderated Moderated discussion group comp.lang.perl.modules Use and development of Perl modules comp.lang.perl.tk Using Tk (and X) from Perl comp.infosystems.www.authoring.cgi Writing CGI scripts for the Web. -There is also a Usenet gateway to Perl mailing lists sponsored by perl.org at -nntp://nntp.perl.org , a web interface to the same lists at -http://nntp.perl.org/group/ and these lists are also available under the -C hierarchy at http://groups.google.com . Other groups are listed at -http://lists.perl.org/ ( also known as http://lists.cpan.org/ ). +Some years ago, comp.lang.perl was divided into those groups, and +comp.lang.perl itself officially removed. While that group may still +be found on some news servers, it is unwise to use it, because +postings there will not appear on news servers which honour the +official list of group names. Use comp.lang.perl.misc for topics +which do not have a more-appropriate specific group. -A nice place to ask questions is the PerlMonks site, http://www.perlmonks.org/ +There is also a Usenet gateway to Perl mailing lists sponsored by +perl.org at nntp://nntp.perl.org , a web interface to the same lists +at http://nntp.perl.org/group/ and these lists are also available +under the C hierarchy at http://groups.google.com . Other +groups are listed at http://lists.perl.org/ ( also known as +http://lists.cpan.org/ ). + +A nice place to ask questions is the PerlMonks site, +http://www.perlmonks.org/ , or the Perl Beginners mailing list +http://lists.perl.org/showlist.cgi?name=beginners . Note that none of the above are supposed to write your code for you: asking questions about particular problems or general advice is fine, @@ -230,7 +239,7 @@ of real-world examples, mini-tutorials, and complete programs is: by Tom Christiansen and Nathan Torkington, with Foreword by Larry Wall ISBN 1-56592-243-3 [1st Edition August 1998] - http://perl.oreilly.com/cookbook/ + http://perl.oreilly.com/catalog/cookbook/ If you're already a seasoned programmer, then the Camel Book might suffice for you to learn Perl from. If you're not, check out the diff --git a/pod/perlfaq3.pod b/pod/perlfaq3.pod index 7843dbf..7c7527e 100644 --- a/pod/perlfaq3.pod +++ b/pod/perlfaq3.pod @@ -1,6 +1,6 @@ =head1 NAME -perlfaq3 - Programming Tools ($Revision: 1.31 $, $Date: 2003/01/03 20:10:11 $) +perlfaq3 - Programming Tools ($Revision: 1.32 $, $Date: 2003/01/26 17:41:53 $) =head1 DESCRIPTION @@ -42,17 +42,12 @@ operations typically found in symbolic debuggers. =head2 Is there a Perl shell? -In general, not yet. There is psh available at - - http://www.focusresearch.com/gregor/psh - -Which includes the following description: - - The Perl Shell is a shell that combines the interactive nature - of a Unix shell with the power of Perl. The goal is to eventually - have a full featured shell that behaves as expected for normal - shell activity. But, the Perl Shell will use Perl syntax and - functionality for control-flow statements and other things. +The psh (Perl sh) is currently at version 1.8. The Perl Shell is a +shell that combines the interactive nature of a Unix shell with the +power of Perl. The goal is a full featured shell that behaves as +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/ . The Shell.pm module (distributed with Perl) makes Perl try commands which aren't part of the Perl language as shell commands. perlsh diff --git a/pod/perlfaq4.pod b/pod/perlfaq4.pod index f7215e2..b77567a 100644 --- a/pod/perlfaq4.pod +++ b/pod/perlfaq4.pod @@ -1,6 +1,6 @@ =head1 NAME -perlfaq4 - Data Manipulation ($Revision: 1.39 $, $Date: 2003/01/03 20:06:21 $) +perlfaq4 - Data Manipulation ($Revision: 1.40 $, $Date: 2003/01/26 17:43:21 $) =head1 DESCRIPTION @@ -142,7 +142,7 @@ Using the CPAN module Bit::Vector: =item How do I convert from decimal to hexadecimal -Using sprint: +Using sprintf: $hex = sprintf("%X", 3735928559); @@ -811,9 +811,6 @@ values of a hash if you use a slice: =head2 How do I pad a string with blanks or pad a number with zeroes? -(This answer contributed by Uri Guttman, with kibitzing from -Bart Lateur.) - In the following examples, C<$pad_len> is the length to which you wish to pad the string, C<$text> or C<$num> contains the string to be padded, and C<$pad_char> contains the padding character. You can use a single @@ -828,13 +825,16 @@ right with blanks and it will truncate the result to a maximum length of C<$pad_len>. # Left padding a string with blanks (no truncation): - $padded = sprintf("%${pad_len}s", $text); + $padded = sprintf("%${pad_len}s", $text); + $padded = sprintf("%*s", $pad_len, $text); # same thing # Right padding a string with blanks (no truncation): - $padded = sprintf("%-${pad_len}s", $text); + $padded = sprintf("%-${pad_len}s", $text); + $padded = sprintf("%-*s", $pad_len, $text); # same thing # Left padding a number with 0 (no truncation): - $padded = sprintf("%0${pad_len}d", $num); + $padded = sprintf("%0${pad_len}d", $num); + $padded = sprintf("%0*d", $pad_len, $num); # same thing # Right padding a string with blanks using pack (will truncate): $padded = pack("A$pad_len",$text); @@ -958,13 +958,13 @@ Stringification also destroys arrays. print "@lines"; # WRONG - extra blanks print @lines; # right -=head2 Why don't my <EHERE documents work? Check for these three things: =over 4 -=item There must be no space after the << part. +=item There must be no space after the EE part. =item There (probably) should be a semicolon at the end. diff --git a/pod/perlfaq5.pod b/pod/perlfaq5.pod index c04f3c6..9e30b54 100644 --- a/pod/perlfaq5.pod +++ b/pod/perlfaq5.pod @@ -1,6 +1,6 @@ =head1 NAME -perlfaq5 - Files and Formats ($Revision: 1.27 $, $Date: 2002/12/06 07:40:11 $) +perlfaq5 - Files and Formats ($Revision: 1.28 $, $Date: 2003/01/26 17:45:46 $) =head1 DESCRIPTION @@ -434,7 +434,7 @@ isn't as exclusive as you might wish. See also the new L if you have it (new for 5.6). -=head2 Why do I sometimes get an "Argument list too long" when I use <*>? +=head2 Why do I sometimes get an "Argument list too long" when I use E*E? The C<< <> >> operator performs a globbing operation (see above). In Perl versions earlier than v5.6.0, the internal glob() operator forks @@ -537,7 +537,7 @@ L if you have it (new for 5.6). =back -=head2 Why can't I just open(FH, ">file.lock")? +=head2 Why can't I just open(FH, "Efile.lock")? A common bit of code B is this: diff --git a/pod/perlfaq7.pod b/pod/perlfaq7.pod index 6eb2a6b..a144457 100644 --- a/pod/perlfaq7.pod +++ b/pod/perlfaq7.pod @@ -1,6 +1,6 @@ =head1 NAME -perlfaq7 - General Perl Language Issues ($Revision: 1.12 $, $Date: 2002/12/06 07:40:11 $) +perlfaq7 - General Perl Language Issues ($Revision: 1.13 $, $Date: 2003/01/26 17:45:46 $) =head1 DESCRIPTION @@ -519,7 +519,7 @@ However, dynamic variables (aka global, local, or package variables) are effectively shallowly bound. Consider this just one more reason not to use them. See the answer to L<"What's a closure?">. -=head2 Why doesn't "my($foo) = ;" work right? +=head2 Why doesn't "my($foo) = EFILEE;" work right? C and C give list context to the right hand side of C<=>. The read operation, like so many of Perl's diff --git a/pod/perlfaq8.pod b/pod/perlfaq8.pod index 31af4bd..164d235 100644 --- a/pod/perlfaq8.pod +++ b/pod/perlfaq8.pod @@ -1,6 +1,6 @@ =head1 NAME -perlfaq8 - System Interaction ($Revision: 1.16 $, $Date: 2003/01/03 20:03:57 $) +perlfaq8 - System Interaction ($Revision: 1.17 $, $Date: 2003/01/26 17:44:04 $) =head1 DESCRIPTION @@ -1036,9 +1036,15 @@ in L. =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.cpan.org/modules/by-module/DBD/ . -A lot of information on this can be found at http://dbi.perl.org/ +The DBI module provides an abstract interface to most database +servers and types, including Oracle, DB2, Sybase, mysql, Postgresql, +ODBC, and flat files. The DBI module accesses each database type +through a database driver, or DBD. You can see a complete list of +available drivers on CPAN: http://www.cpan.org/modules/by-module/DBD/ . +You can read more about DBI on http://dbi.perl.org . + +Other modules provide more specific access: Win32::ODBC, Alzabo, iodbc, +and others found on CPAN Search: http://search.cpan.org . =head2 How do I make a system() exit on control-C?