> It looks like your version of the perlfaq docs are out of sync > with the perlfaq repository. I updated the repository with > this change, although I had to do it by hand.
There have been a few other changes recently. 23382 and 23392 come to mind. > In the past, someone periodically updated the core with the > latest perlfaq, and that worked pretty well. Bi-directional syncs are fun. Attached find a patch between perl-current and latest perlfaq cvs. (It should be sanity checked first. We don't want to revert anything.) It would be nice to get this into 5.8.6. > > Change 23423 by [EMAIL PROTECTED] on 2004/10/25 15:09:27 > > > Perl Mongers is an advocacy organization for the Perl language which > > -maintains the web site http://www.perl.org/ as a general advocacy > > +maintains the web site http://www.pm.org/ as a general advocacy > > site for the Perl language. > > this one is should have stayed the same :) Except for the Perl Mongers part. -R
--- ../perl-5.9.x/pod/perlfaq1.pod 2003-12-02 15:37:02.000000000 -0800 +++ perlfaq1.pod 2004-10-25 21:19:33.917744616 -0700 @@ -1,6 +1,6 @@ =head1 NAME -perlfaq1 - General Questions About Perl ($Revision: 1.14 $, $Date: 2003/11/23 08:02:29 $) +perlfaq1 - General Questions About Perl ($Revision: 1.15 $, $Date: 2004/10/11 05:06:29 $) =head1 DESCRIPTION @@ -173,7 +173,7 @@ set of tasks. These languages have their own newsgroups in which you can learn about (but hopefully not argue about) them. -Some comparison documents can be found at http://language.perl.com/versus/ +Some comparison documents can be found at http://www.perl.com/doc/FMTEYEWTK/versus/ if you really can't stop yourself. =head2 Can I do [task] in Perl? --- ../perl-5.9.x/pod/perlfaq2.pod 2004-10-25 09:38:53.000000000 -0700 +++ perlfaq2.pod 2004-10-25 21:19:33.964737472 -0700 @@ -1,6 +1,6 @@ =head1 NAME -perlfaq2 - Obtaining and Learning about Perl ($Revision: 1.25 $, $Date: 2003/10/16 04:57:38 $) +perlfaq2 - Obtaining and Learning about Perl ($Revision: 1.29 $, $Date: 2004/10/25 18:37:23 $) =head1 DESCRIPTION @@ -129,7 +129,7 @@ See http://www.cpan.org/modules/00modlist.long.html or http://search.cpan.org/ for a more complete list of modules by category. -CPAN is not affiliated with O'Reilly and Associates. +CPAN is not affiliated with O'Reilly Media. =head2 Is there an ISO or ANSI certified version of Perl? @@ -218,34 +218,34 @@ =head2 Perl Books -A number of books on Perl and/or CGI programming are available. A few of -these are good, some are OK, but many aren't worth your money. Tom -Christiansen maintains a list of these books, some with extensive -reviews, at http://www.perl.com/perl/critiques/index.html . +A number of books on Perl and/or CGI programming are available. A few +of these are good, some are OK, but many aren't worth your money. +There is a list of these books, some with extensive reviews, at +http://books.perl.org/ . The incontestably definitive reference book on Perl, written by -the creator of Perl, is now (July 2000) in its third edition: +the creator of Perl, is now (Sept 2004) in its third edition: - Programming Perl (the "Camel Book"): + Programming Perl (the "Camel Book"): by Larry Wall, Tom Christiansen, and Jon Orwant - 0-596-00027-8 [3rd edition July 2000] + ISBN 0-596-00027-8 [3rd edition July 2000] http://www.oreilly.com/catalog/pperl3/ - (English, translations to several languages are also available) + (English, translations to several languages are also available) The companion volume to the Camel containing thousands of real-world examples, mini-tutorials, and complete programs is: - The Perl Cookbook (the "Ram Book"): + The Perl Cookbook (the "Ram Book"): by Tom Christiansen and Nathan Torkington, with Foreword by Larry Wall - ISBN 1-56592-243-3 [1st Edition August 1998] - http://perl.oreilly.com/catalog/cookbook/ + ISBN 0-596-00313-7 [2nd Edition August 2003] + http://www.oreilly.com/catalog/perlckbk2/ 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 Llama book: - Learning Perl (the "Llama Book") + Learning Perl (the "Llama Book") by Randal L. Schwartz and Tom Phoenix ISBN 0-596-00132-0 [3rd edition July 2001] http://www.oreilly.com/catalog/lperl3/ @@ -254,26 +254,26 @@ presented in the same style as the Llama book, continue your education with the Alpaca book: - Learning Perl Objects, References, and Modules (the "Alpaca Book") - by Randal L. Schwartz, with Tom Phoenix (foreword by Damian Conway) - ISBN 0-596-00478-8 [1st edition June 2003] - http://www.oreilly.com/catalog/lrnperlorm/ + Learning Perl Objects, References, and Modules (the "Alpaca Book") + by Randal L. Schwartz, with Tom Phoenix (foreword by Damian Conway) + ISBN 0-596-00478-8 [1st edition June 2003] + http://www.oreilly.com/catalog/lrnperlorm/ If you're not an accidental programmer, but a more serious and possibly even degreed computer scientist who doesn't need as much hand-holding as we try to provide in the Llama, please check out the delightful book - Perl: The Programmer's Companion - by Nigel Chapman - ISBN 0-471-97563-X [1997, 3rd printing Spring 1998] - http://www.wiley.com/compbooks/catalog/97563-X.htm - http://www.wiley.com/compbooks/chapman/perl/perltpc.html (errata etc) + Perl: The Programmer's Companion + by Nigel Chapman + ISBN 0-471-97563-X [1997, 3rd printing Spring 1998] + http://www.wiley.com/compbooks/catalog/97563-X.htm + http://www.wiley.com/compbooks/chapman/perl/perltpc.html (errata etc) If you are more at home in Windows the following is available (though unfortunately rather dated). - Learning Perl on Win32 Systems (the "Gecko Book") + Learning Perl on Win32 Systems (the "Gecko Book") by Randal L. Schwartz, Erik Olson, and Tom Christiansen, with foreword by Larry Wall ISBN 1-56592-324-3 [1st edition August 1997] @@ -296,56 +296,56 @@ =item References - Programming Perl + Programming Perl by Larry Wall, Tom Christiansen, and Jon Orwant ISBN 0-596-00027-8 [3rd edition July 2000] http://www.oreilly.com/catalog/pperl3/ - Perl 5 Pocket Reference - by Johan Vromans + Perl 5 Pocket Reference + by Johan Vromans ISBN 0-596-00032-4 [3rd edition May 2000] http://www.oreilly.com/catalog/perlpr3/ - Perl in a Nutshell - by Ellen Siever, Stephan Spainhour, and Nathan Patwardhan + Perl in a Nutshell + by Ellen Siever, Stephan Spainhour, and Nathan Patwardhan ISBN 1-56592-286-7 [1st edition December 1998] http://www.oreilly.com/catalog/perlnut/ =item Tutorials - Elements of Programming with Perl + Elements of Programming with Perl by Andrew L. Johnson ISBN 1-884777-80-5 [1st edition October 1999] http://www.manning.com/Johnson/ - Learning Perl + Learning Perl by Randal L. Schwartz and Tom Phoenix ISBN 0-596-00132-0 [3rd edition July 2001] http://www.oreilly.com/catalog/lperl3/ - Learning Perl Objects, References, and Modules - by Randal L. Schwartz, with Tom Phoenix (foreword by Damian Conway) - ISBN 0-596-00478-8 [1st edition June 2003] - http://www.oreilly.com/catalog/lrnperlorm/ + Learning Perl Objects, References, and Modules + by Randal L. Schwartz, with Tom Phoenix (foreword by Damian Conway) + ISBN 0-596-00478-8 [1st edition June 2003] + http://www.oreilly.com/catalog/lrnperlorm/ - Learning Perl on Win32 Systems + Learning Perl on Win32 Systems by Randal L. Schwartz, Erik Olson, and Tom Christiansen, with foreword by Larry Wall ISBN 1-56592-324-3 [1st edition August 1997] http://www.oreilly.com/catalog/lperlwin/ - Perl: The Programmer's Companion + Perl: The Programmer's Companion by Nigel Chapman ISBN 0-471-97563-X [1997, 3rd printing Spring 1998] - http://www.wiley.com/compbooks/catalog/97563-X.htm - http://www.wiley.com/compbooks/chapman/perl/perltpc.html (errata etc) + http://www.wiley.com/compbooks/catalog/97563-X.htm + http://www.wiley.com/compbooks/chapman/perl/perltpc.html (errata etc) - Cross-Platform Perl + Cross-Platform Perl by Eric Foster-Johnson ISBN 1-55851-483-X [2nd edition September 2000] http://www.pconline.com/~erc/perlbook.htm - MacPerl: Power and Ease + MacPerl: Power and Ease by Vicki Brown and Chris Nandor, with foreword by Matthias Neeracher ISBN 1-881957-32-2 [1st edition May 1998] @@ -353,21 +353,20 @@ =item Task-Oriented - The Perl Cookbook + The Perl Cookbook by Tom Christiansen and Nathan Torkington with foreword by Larry Wall ISBN 1-56592-243-3 [1st edition August 1998] http://www.oreilly.com/catalog/cookbook/ - Effective Perl Programming + Effective Perl Programming by Joseph Hall ISBN 0-201-41975-0 [1st edition 1998] http://www.awl.com/ - =item Special Topics - Mastering Regular Expressions + Mastering Regular Expressions by Jeffrey E. F. Friedl ISBN 0-596-00289-0 [2nd edition July 2002] http://www.oreilly.com/catalog/regex2/ @@ -393,15 +392,15 @@ ISBN 1-56592-716-8 [1st edition January 2002] http://www.oreilly.com/catalog/mastperltk/ - Extending and Embedding Perl - by Tim Jenness and Simon Cozens - ISBN 1-930110-82-0 [1st edition August 2002] - http://www.manning.com/jenness - - Perl Debugger Pocket Reference - by Richard Foley - ISBN 0-596-00503-2 [1st edition January 2004] - http://www.oreilly.com/catalog/perldebugpr/ + Extending and Embedding Perl + by Tim Jenness and Simon Cozens + ISBN 1-930110-82-0 [1st edition August 2002] + http://www.manning.com/jenness + + Perl Debugger Pocket Reference + by Richard Foley + ISBN 0-596-00503-2 [1st edition January 2004] + http://www.oreilly.com/catalog/perldebugpr/ =back @@ -481,32 +480,6 @@ and in the proprietary Microsoft flavor); the free Unix distributions also all come with Perl. -Alternatively, you can purchase commercial incidence based support -through the Perl Clinic. The following is a commercial from them: - -"The Perl Clinic is a commercial Perl support service operated by -ActiveState Tool Corp. and The Ingram Group. The operators have many -years of in-depth experience with Perl applications and Perl internals -on a wide range of platforms. - -"Through our group of highly experienced and well-trained support engineers, -we will put our best effort into understanding your problem, providing an -explanation of the situation, and a recommendation on how to proceed." - -Contact The Perl Clinic at - - www.PerlClinic.com - - North America Pacific Standard Time (GMT-8) - Tel: 1 604 606-4611 hours 8am-6pm - Fax: 1 604 606-4640 - - Europe (GMT) - Tel: 00 44 1483 862814 - Fax: 00 44 1483 862801 - -See also www.perl.com for updates on tutorials, training, and support. - =head2 Where do I send bug reports? If you are reporting a bug in the perl interpreter or the modules @@ -523,29 +496,27 @@ =head2 What is perl.com? Perl Mongers? pm.org? perl.org? cpan.org? -Perl.com at http://www.perl.com/ is part of the O'Reilly Network, a subsidiary -of O'Reilly Media. +Perl.com at http://www.perl.com/ is part of the O'Reilly Network, a +subsidiary of O'Reilly Media. -Perl Mongers is an advocacy organization for the Perl language which -maintains the web site http://www.pm.org/ as a general advocacy -site for the Perl language. +The Perl Foundation is an advocacy organization for the Perl language +which maintains the web site http://www.perl.org/ as a general +advocacy site for the Perl language. It uses the domain to provide +general support services to the Perl community, including the hosting +of mailing lists, web sites, and other services. The web site +http://www.perl.org/ is a general advocacy site for the Perl language, +and there are many other sub-domains for special topics, such as + + http://learn.perl.org/ + http://use.perl.org/ + http://jobs.perl.org/ + http://lists.perl.org/ Perl Mongers uses the pm.org domain for services related to Perl user groups, including the hosting of mailing lists and web sites. See the Perl user group web site at http://www.pm.org/ for more information about joining, starting, or requesting services for a Perl user group. -The Perl Foundation maintains the perl.org domain to provide general -support services to the Perl community, including the hosting of mailing -lists, web sites, and other services. The web site -http://www.perl.org/ is a general advocacy site for the Perl language, -and there are many other sub-domains for special topics, such as - - http://learn.perl.org/ - http://use.perl.org/ - http://jobs.perl.org/ - http://lists.perl.org/ - http://www.cpan.org/ is the Comprehensive Perl Archive Network, a replicated worlwide repository of Perl software, see the I<What is CPAN?> question earlier in this document. --- ../perl-5.9.x/pod/perlfaq3.pod 2003-12-02 15:37:02.000000000 -0800 +++ perlfaq3.pod 2004-10-25 21:19:33.980735040 -0700 @@ -1,6 +1,6 @@ =head1 NAME -perlfaq3 - Programming Tools ($Revision: 1.37 $, $Date: 2003/11/24 19:55:50 $) +perlfaq3 - Programming Tools ($Revision: 1.40 $, $Date: 2004/10/19 17:02:27 $) =head1 DESCRIPTION @@ -227,16 +227,10 @@ 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 +( http://www.ActiveState.com/Products/Komodo/ ). (Visual Perl, a Visual Studio.NET plug-in is currently (early 2001) in beta ( http://www.ActiveState.com/Products/VisualPerl/index.html )). -=item The Object System - -( http://www.castlelink.co.uk/object_system/ ) is a Perl web -applications development IDE, apparently for any platform -that runs Perl. - =item Open Perl IDE ( http://open-perl-ide.sourceforge.net/ ) @@ -279,7 +273,7 @@ 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 @@ -338,7 +332,7 @@ =item Codewright -http://www.starbase.com/ +http://www.borland.com/codewright/ =item MultiEdit @@ -399,16 +393,22 @@ =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 @@ -454,7 +454,7 @@ 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 @@ -780,7 +780,7 @@ =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 --- ../perl-5.9.x/pod/perlfaq4.pod 2003-12-02 15:37:02.000000000 -0800 +++ perlfaq4.pod 2004-10-25 21:19:34.047724856 -0700 @@ -1,6 +1,6 @@ =head1 NAME -perlfaq4 - Data Manipulation ($Revision: 1.54 $, $Date: 2003/11/30 00:50:08 $) +perlfaq4 - Data Manipulation ($Revision: 1.55 $, $Date: 2004/10/11 05:06:29 $) =head1 DESCRIPTION @@ -559,7 +559,7 @@ That doesn't mean that Perl can't be used to create non-Y2K compliant programs. It can. But so can your pencil. It's the fault of the user, not the language. At the risk of inflaming the NRA: ``Perl doesn't -break Y2K, people do.'' See http://language.perl.com/news/y2k.html for +break Y2K, people do.'' See http://www.perl.org/about/y2k.html for a longer exposition. =head1 Data: Strings --- ../perl-5.9.x/pod/perlfaq5.pod 2004-02-01 09:59:21.000000000 -0800 +++ perlfaq5.pod 2004-02-06 20:29:50.000000000 -0800 @@ -1,6 +1,6 @@ =head1 NAME -perlfaq5 - Files and Formats ($Revision: 1.30 $, $Date: 2003/11/23 08:07:46 $) +perlfaq5 - Files and Formats ($Revision: 1.31 $, $Date: 2004/02/07 04:29:50 $) =head1 DESCRIPTION --- ../perl-5.9.x/pod/perlfaq6.pod 2003-09-10 13:55:44.000000000 -0700 +++ perlfaq6.pod 2004-10-25 21:19:34.053723944 -0700 @@ -1,6 +1,6 @@ =head1 NAME -perlfaq6 - Regular Expressions ($Revision: 1.20 $, $Date: 2003/01/03 20:05:28 $) +perlfaq6 - Regular Expressions ($Revision: 1.26 $, $Date: 2004/10/25 18:47:04 $) =head1 DESCRIPTION @@ -354,7 +354,7 @@ $/ = undef; $_ = <>; - s#/\*[^*]*\*+([^/*][^*]*\*+)*/|("(\\.|[^"\\])*"|'(\\.|[^'\\])*'|.[^/"'\\]*)#$2#gs + s#/\*[^*]*\*+([^/*][^*]*\*+)*/|("(\\.|[^"\\])*"|'(\\.|[^'\\])*'|.[^/"'\\]*)#defined $2 ? $2 : ""#gse; print; This could, of course, be more legibly written with the C</x> modifier, adding @@ -395,11 +395,11 @@ . ## Anything other char [^/"'\\]* ## Chars which doesn't start a comment, string or escape ) - }{$2}gxs; + }{defined $2 ? $2 : ""}gxse; A slight modification also removes C++ comments: - s#/\*[^*]*\*+([^/*][^*]*\*+)*/|//[^\n]*|("(\\.|[^"\\])*"|'(\\.|[^'\\])*'|.[^/"'\\]*)#$2#gs; + s#/\*[^*]*\*+([^/*][^*]*\*+)*/|//[^\n]*|("(\\.|[^"\\])*"|'(\\.|[^'\\])*'|.[^/"'\\]*)#defined $2 ? $2 : ""#gse; =head2 Can I use Perl regular expressions to match balanced text? @@ -745,17 +745,17 @@ } Here's another, slightly less painful, way to do it from Benjamin -Goldberg: +Goldberg, who uses a zero-width negative look-behind assertion. - $martian =~ m/ - (?!<[A-Z]) - (?:[A-Z][A-Z])*? - GX - /x; + print "found GX!\n" if $martian =~ m/ + (?<![A-Z]) + (?:[A-Z][A-Z])*? + GX + /x; This succeeds if the "martian" character GX is in the string, and fails -otherwise. If you don't like using (?!<), you can replace (?!<[A-Z]) -with (?:^|[^A-Z]). +otherwise. If you don't like using (?<!), a zero-width negative +look-behind assertion, you can replace (?<![A-Z]) with (?:^|[^A-Z]). It does have the drawback of putting the wrong thing in $-[0] and $+[0], but this usually can be worked around. --- ../perl-5.9.x/pod/perlfaq7.pod 2003-09-23 17:36:15.000000000 -0700 +++ perlfaq7.pod 2004-10-25 21:19:34.055723640 -0700 @@ -1,6 +1,6 @@ =head1 NAME -perlfaq7 - General Perl Language Issues ($Revision: 1.15 $, $Date: 2003/07/24 02:17:21 $) +perlfaq7 - General Perl Language Issues ($Revision: 1.17 $, $Date: 2004/10/19 22:53:50 $) =head1 DESCRIPTION @@ -213,7 +213,7 @@ Here's a classic function-generating function: sub add_function_generator { - return sub { shift + shift }; + return sub { shift() + shift() }; } $add_sub = add_function_generator(); @@ -232,7 +232,7 @@ sub make_adder { my $addpiece = shift; - return sub { shift + $addpiece }; + return sub { shift() + $addpiece }; } $f1 = make_adder(20); --- ../perl-5.9.x/pod/perlfaq8.pod 2004-02-01 09:59:21.000000000 -0800 +++ perlfaq8.pod 2004-10-25 21:19:34.061722728 -0700 @@ -1,6 +1,6 @@ =head1 NAME -perlfaq8 - System Interaction ($Revision: 1.17 $, $Date: 2003/01/26 17:44:04 $) +perlfaq8 - System Interaction ($Revision: 1.22 $, $Date: 2004/10/05 22:13:49 $) =head1 DESCRIPTION @@ -413,31 +413,30 @@ Signals are documented in L<perlipc/"Signals"> and the section on ``Signals'' in the Camel. -Be warned that very few C libraries are re-entrant. Therefore, if you -attempt to print() in a handler that got invoked during another stdio -operation your internal structures will likely be in an -inconsistent state, and your program will dump core. You can -sometimes avoid this by using syswrite() instead of print(). - -Unless you're exceedingly careful, the only safe things to do inside a -signal handler are (1) set a variable and (2) exit. In the first case, -you should only set a variable in such a way that malloc() is not -called (eg, by setting a variable that already has a value). - -For example: - - $Interrupted = 0; # to ensure it has a value - $SIG{INT} = sub { - $Interrupted++; - syswrite(STDERR, "ouch\n", 5); - } +You can set the values of the %SIG hash to be the functions you want +to handle the signal. After perl catches the signal, it looks in %SIG +for a key with the same name as the signal, then calls the subroutine +value for that key. + + # as an anonymous subroutine + + $SIG{INT} = sub { syswrite(STDERR, "ouch\n", 5 ) }; + + # or a reference to a function + + $SIG{INT} = \&ouch; + + # or the name of the function as a string + + $SIG{INT} = "ouch"; + +Perl versions before 5.8 had in its C source code signal handlers which +would catch the signal and possibly run a Perl function that you had set +in %SIG. This violated the rules of signal handling at that level +causing perl to dump core. Since version 5.8.0, perl looks at %SIG +*after* the signal has been caught, rather than while it is being caught. +Previous versions of this answer were incorrect. -However, because syscalls restart by default, you'll find that if -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 the section on ``Signals'' -in the Camel book. =head2 How do I modify the shadow password file on a Unix system? @@ -1066,6 +1065,74 @@ sysopen(FH, "/foo/somefile", O_WRONLY|O_NDELAY|O_CREAT, 0644) or die "can't open /foo/somefile: $!": +=head2 How do I tell the difference between errors from the shell and perl? + +(answer contributed by brian d foy, C<< <[EMAIL PROTECTED]> >> + +When you run a Perl script, something else is running the script for you, +and that something else may output error messages. The script might +emit its own warnings and error messages. Most of the time you cannot +tell who said what. + +You probably cannot fix the thing that runs perl, but you can change how +perl outputs its warnings by defining a custom warning and die functions. + +Consider this script, which has an error you may not notice immediately. + + #!/usr/locl/bin/perl + + print "Hello World\n"; + +I get an error when I run this from my shell (which happens to be +bash). That may look like perl forgot it has a print() function, +but my shebang line is not the path to perl, so the shell runs the +script, and I get the error. + + $ ./test + ./test: line 3: print: command not found + +A quick and dirty fix involves a little bit of code, but this may be all +you need to figure out the problem. + + #!/usr/bin/perl -w + + BEGIN { + $SIG{__WARN__} = sub{ print STDERR "Perl: ", @_; }; + $SIG{__DIE__} = sub{ print STDERR "Perl: ", @_; exit 1}; + } + + $a = 1 + undef; + $x / 0; + __END__ + +The perl message comes out with "Perl" in front. The BEGIN block +works at compile time so all of the compilation errors and warnings +get the "Perl:" prefix too. + + Perl: Useless use of division (/) in void context at ./test line 9. + Perl: Name "main::a" used only once: possible typo at ./test line 8. + Perl: Name "main::x" used only once: possible typo at ./test line 9. + Perl: Use of uninitialized value in addition (+) at ./test line 8. + Perl: Use of uninitialized value in division (/) at ./test line 9. + Perl: Illegal division by zero at ./test line 9. + Perl: Illegal division by zero at -e line 3. + +If I don't see that "Perl:", it's not from perl. + +You could also just know all the perl errors, and although there are +some people who may know all of them, you probably don't. However, they +all should be in the perldiag manpage. If you don't find the error in +there, it probably isn't a perl error. + +Looking up every message is not the easiest way, so let perl to do it +for you. Use the diagnostics pragma with turns perl's normal messages +into longer discussions on the topic. + + use diagnostics; + +If you don't get a paragraph or two of expanded discussion, it +might not be perl's message. + =head2 How do I install a module from CPAN? The easiest way is to have a module also named CPAN do it for you. --- ../perl-5.9.x/pod/perlfaq.pod 2003-04-10 13:59:14.000000000 -0700 +++ perlfaq.pod 2004-10-25 21:19:33.902746896 -0700 @@ -1,6 +1,6 @@ =head1 NAME -perlfaq - frequently asked questions about Perl ($Date: 2003/01/31 17:37:17 $) +perlfaq - frequently asked questions about Perl ($Date: 2004/10/05 22:15:44 $) =head1 DESCRIPTION @@ -98,6 +98,7 @@ =head1 The Questions + =head2 L<perlfaq1>: General Questions About Perl Very general, high-level questions about Perl. @@ -122,6 +123,10 @@ =item * +What is Ponie? + +=item * + What is perl6? =item * @@ -169,8 +174,7 @@ =head2 L<perlfaq2>: Obtaining and Learning about Perl -Where to find source and documentation for Perl, support, -and related matters. +Where to find source and documentation for Perl, support, and related matters. =over 4 @@ -374,7 +378,6 @@ =item * I've read perlembed, perlguts, etc., but I can't embed perl in -my C program; what am I doing wrong? =item * @@ -389,8 +392,7 @@ =head2 L<perlfaq4>: Data Manipulation -Manipulating numbers, dates, strings, arrays, hashes, and -miscellaneous data issues. +Manipulating numbers, dates, strings, arrays, hashes, and miscellaneous data issues. =over 4 @@ -400,6 +402,10 @@ =item * +Why is int() broken? + +=item * + Why isn't my octal data interpreted correctly? =item * @@ -408,7 +414,7 @@ =item * -How do I convert between numeric representations? +How do I convert between numeric representations/bases/radixes? =item * @@ -833,7 +839,7 @@ =item * -Why can't I use "C:\temp\foo" in DOS paths? What doesn't `C:\temp\foo.exe` work? +Why can't I use "C:\temp\foo" in DOS paths? Why doesn't `C:\temp\foo.exe` work? =item * @@ -856,7 +862,7 @@ =head2 L<perlfaq6>: Regular Expressions -Pattern matching and regular expressions. +This section is surprisingly small because the rest of the FAQ is littered with answers involving regular expressions. For example, decoding a URL and checking whether something is a number are handled with regular expressions, but those answers are found elsewhere in this document (in L<perlfaq9>: ``How do I decode or create those %-encodings on the web'' and L<perlfaq4>: ``How do I determine whether a scalar is a number/whole/integer/float'', to be precise). =over 4 @@ -942,7 +948,7 @@ =item * -What's wrong with using grep or map in a void context? +What's wrong with using grep in a void context? =item * @@ -957,8 +963,7 @@ =head2 L<perlfaq7>: General Perl Language Issues -General Perl language issues that don't clearly fit into any of the -other sections. +General Perl language issues that don't clearly fit into any of the other sections. =over 4 @@ -1083,8 +1088,7 @@ =head2 L<perlfaq8>: System Interaction -Interprocess communication (IPC), control over the user-interface -(keyboard, screen and pointing devices). +This section of the Perl FAQ covers questions involving operating system interaction. Topics include interprocess communication (IPC), control over the user-interface (keyboard, screen and pointing devices), and most anything else not related to data manipulation. Read the FAQs and documentation specific to the port of perl to your operating system (eg, L<perlvms>, L<perlplan9>, ...). These should contain more detailed information on the vagaries of your perl. =over 4 @@ -1262,6 +1266,10 @@ =item * +How do I tell the difference between errors from the shell and perl? + +=item * + How do I install a module from CPAN? =item * @@ -1278,7 +1286,7 @@ =item * -How do I add a directory to my include path at runtime? +How do I add a directory to my include path (@INC) at runtime? =item *
