From: Rafael Garcia-Suarez Date: Wed, 17 Nov 2004 10:22:52 +0000 (+0000) Subject: PerlFAQ sync. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=28b41a8090d259cff9b1dd87c0c53b3c4a31e822;p=p5sagit%2Fp5-mst-13.2.git PerlFAQ sync. p4raw-id: //depot/perl@23509 --- diff --git a/pod/perlfaq3.pod b/pod/perlfaq3.pod index 7c6eb5f..411e857 100644 --- a/pod/perlfaq3.pod +++ b/pod/perlfaq3.pod @@ -1,6 +1,6 @@ =head1 NAME -perlfaq3 - Programming Tools ($Revision: 1.40 $, $Date: 2004/10/19 17:02:27 $) +perlfaq3 - Programming Tools ($Revision: 1.41 $, $Date: 2004/11/03 22:45:32 $) =head1 DESCRIPTION @@ -218,18 +218,24 @@ If you're on Unix, you already have an IDE--Unix itself. The UNIX philosophy is the philosophy of several small tools that each do one thing and do it well. It's like a carpenter's toolbox. -If you want an IDE, check the following: +If you want an IDE, check the following (in alphabetical order, not +order of preference): =over 4 +=item Eclipse + +The Eclipse Perl Integration Project integrates Perl +editing/debugging with Eclipse. + +The website for the project is http://e-p-i-c.sf.net/ + =item Komodo -ActiveState's cross-platform (as of April 2001 Windows and Linux), -multi-language IDE has Perl support, including a regular expression +ActiveState's cross-platform (as of October 2004, that's Windows, Linux, +and Solaris), multi-language IDE has Perl support, including a regular expression debugger and remote debugging -( 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 )). +( http://www.ActiveState.com/Products/Komodo/ ). =item Open Perl IDE @@ -238,6 +244,11 @@ Open Perl IDE is an integrated development environment for writing and debugging Perl scripts with ActiveState's ActivePerl distribution under Windows 95/98/NT/2000. +=item OptiPerl + +( http://www.optiperl.com/ ) is a Windows IDE with simulated CGI +environment, including debugger and syntax highlighting editor. + =item PerlBuilder ( http://www.solutionsoft.com/perl.htm ) is an integrated development @@ -248,10 +259,11 @@ environment for Windows that supports Perl development. ( http://helpconsulting.net/visiperl/ ) From Help Consulting, for Windows. -=item OptiPerl +=item Visual Perl + +( http://www.activestate.com/Products/Visual_Perl/ ) +Visual Perl is a Visual Studio.NET plug-in from ActiveState. -( http://www.optiperl.com/ ) is a Windows IDE with simulated CGI -environment, including debugger and syntax highlighting editor. =back diff --git a/pod/perlfaq4.pod b/pod/perlfaq4.pod index 0e62c2b..815a9ea 100644 --- a/pod/perlfaq4.pod +++ b/pod/perlfaq4.pod @@ -1,6 +1,6 @@ =head1 NAME -perlfaq4 - Data Manipulation ($Revision: 1.55 $, $Date: 2004/10/11 05:06:29 $) +perlfaq4 - Data Manipulation ($Revision: 1.56 $, $Date: 2004/11/03 22:47:56 $) =head1 DESCRIPTION @@ -1715,19 +1715,15 @@ sorting the keys as shown in an earlier question. =head2 What happens if I add or remove keys from a hash while iterating over it? -Don't do that. :-) +(contributed by brian d foy) -[lwall] In Perl 4, you were not allowed to modify a hash at all while -iterating over it. In Perl 5 you can delete from it, but you still -can't add to it, because that might cause a doubling of the hash table, -in which half the entries get copied up to the new top half of the -table, at which point you've totally bamboozled the iterator code. -Even if the table doesn't double, there's no telling whether your new -entry will be inserted before or after the current iterator position. +The easy answer is "Don't do that!" -Either treasure up your changes and make them after the iterator finishes -or use keys to fetch all the old keys at once, and iterate over the list -of keys. +If you iterate through the hash with each(), you can delete the key +most recently returned without worrying about it. If you delete or add +other keys, the iterator may skip or double up on them since perl +may rearrange the hash table. See the +entry for C in L. =head2 How do I look up a hash element by value? diff --git a/pod/perlfaq6.pod b/pod/perlfaq6.pod index d19ba36..6b0f3bb 100644 --- a/pod/perlfaq6.pod +++ b/pod/perlfaq6.pod @@ -1,6 +1,6 @@ =head1 NAME -perlfaq6 - Regular Expressions ($Revision: 1.26 $, $Date: 2004/10/25 18:47:04 $) +perlfaq6 - Regular Expressions ($Revision: 1.27 $, $Date: 2004/11/03 22:52:16 $) =head1 DESCRIPTION @@ -151,7 +151,19 @@ Up to Perl 5.8.0, $/ has to be a string. This may change in 5.10, but don't get your hopes up. Until then, you can use these examples if you really need to do this. -Use the four argument form of sysread to continually add to +If you have File::Stream, this is easy. + + use File::Stream; + my $stream = File::Stream->new( + $filehandle, + separator => qr/\s*,\s*/, + ); + + print "$_\n" while <$stream>; + +If you don't have File::Stream, you have to do a little more work. + +You can use the four argument form of sysread to continually add to a buffer. After you add to the buffer, you check if you have a complete line (using your regular expression). diff --git a/pod/perlfaq7.pod b/pod/perlfaq7.pod index e6d4e5c..54e91bd 100644 --- a/pod/perlfaq7.pod +++ b/pod/perlfaq7.pod @@ -1,6 +1,6 @@ =head1 NAME -perlfaq7 - General Perl Language Issues ($Revision: 1.17 $, $Date: 2004/10/19 22:53:50 $) +perlfaq7 - General Perl Language Issues ($Revision: 1.18 $, $Date: 2004/11/03 22:54:08 $) =head1 DESCRIPTION @@ -97,6 +97,16 @@ See L for more details. no warnings; # temporarily turn off warnings $a = $b + $c; # I know these might be undef } + +Additionally, you can enable and disable categories of warnings. +You turn off the categories you want to ignore and you can still +get other categories of warnings. See L for the +complete details, including the category names and hierarchy. + + { + no warnings 'uninitialized'; + $a = $b + $c; + } If you have an older version of Perl, the C<$^W> variable (documented in L) controls runtime warnings for a block: