Mopup for #6204.
[p5sagit/p5-mst-13.2.git] / pod / perlfaq7.pod
index 070d965..1ca7893 100644 (file)
@@ -35,12 +35,12 @@ really type specifiers are:
     <> are used for inputting a record from a filehandle.
     \  takes a reference to something.
 
-Note that E<lt>FILEE<gt> is I<neither> the type specifier for files
-nor the name of the handle.  It is the C<E<lt>E<gt>> operator applied
+Note that <FILE> is I<neither> the type specifier for files
+nor the name of the handle.  It is the C<< <> >> operator applied
 to the handle FILE.  It reads one line (well, record - see
 L<perlvar/$/>) from the handle FILE in scalar context, or I<all> lines
 in list context.  When performing open, close, or any other operation
-besides C<E<lt>E<gt>> on files, or even talking about the handle, do
+besides C<< <> >> on files, or even talking about the handle, do
 I<not> use the brackets.  These are correct: C<eof(FH)>, C<seek(FH, 0,
 2)> and "copying from STDIN to FILE".
 
@@ -49,7 +49,7 @@ I<not> use the brackets.  These are correct: C<eof(FH)>, C<seek(FH, 0,
 Normally, a bareword doesn't need to be quoted, but in most cases
 probably should be (and must be under C<use strict>).  But a hash key
 consisting of a simple word (that isn't the name of a defined
-subroutine) and the left-hand operand to the C<=E<gt>> operator both
+subroutine) and the left-hand operand to the C<< => >> operator both
 count as though they were quoted:
 
     This                    is like this
@@ -84,8 +84,17 @@ Another way is to use undef as an element on the left-hand-side:
 
 =head2 How do I temporarily block warnings?
 
-The C<$^W> variable (documented in L<perlvar>) controls
-runtime warnings for a block:
+If you are running Perl 5.6.0 or better, the C<use warnings> pragma
+allows fine control of what warning are produced.
+See L<perllexwarn> for more details.
+
+    {
+       no warnings;          # temporarily turn off warnings
+       $a = $b + $c;         # I know these might be undef
+    }
+
+If you have an older version of Perl, the C<$^W> variable (documented
+in L<perlvar>) controls runtime warnings for a block:
 
     {
        local $^W = 0;        # temporarily turn off warnings
@@ -95,10 +104,6 @@ runtime warnings for a block:
 Note that like all the punctuation variables, you cannot currently
 use my() on C<$^W>, only local().
 
-A new C<use warnings> pragma is in the works to provide finer control
-over all this.  The curious should check the perl5-porters mailing list
-archives for details.
-
 =head2 What's an extension?
 
 A way of calling compiled C code from Perl.  Reading L<perlxstut>
@@ -168,10 +173,11 @@ own module.  Make sure to change the names appropriately.
     package Some::Module;  # assumes Some/Module.pm
 
     use strict;
+    use warnings;
 
     BEGIN {
        use Exporter   ();
-       use vars       qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
+       our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
 
        ## set the version for version checking; uncomment to use
        ## $VERSION     = 1.00;
@@ -188,10 +194,11 @@ own module.  Make sure to change the names appropriately.
        # as well as any optionally exported functions
        @EXPORT_OK   = qw($Var1 %Hashit);
     }
-    use vars      @EXPORT_OK;
+    our @EXPORT_OK;
 
     # non-exported package globals go here
-    use vars      qw( @more $stuff );
+    our @more;
+    our $stuff;
 
     # initialize package globals, first exported ones
     $Var1   = '';
@@ -306,10 +313,10 @@ you want to pass in a bit of code into a function:
     my $line;
     timeout( 30, sub { $line = <STDIN> } );
 
-If the code to execute had been passed in as a string, C<'$line =
-E<lt>STDINE<gt>'>, there would have been no way for the hypothetical
-timeout() function to access the lexical variable $line back in its
-caller's scope.
+If the code to execute had been passed in as a string,
+C<< '$line = <STDIN>' >>, there would have been no way for the
+hypothetical timeout() function to access the lexical variable
+$line back in its caller's scope.
 
 =head2 What is variable suicide and how can I prevent it?
 
@@ -580,10 +587,10 @@ 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) = E<lt>FILEE<gt>;" work right?
+=head2 Why doesn't "my($foo) = <FILE>;" work right?
 
 C<my()> and C<local()> give list context to the right hand side
-of C<=>.  The E<lt>FHE<gt> read operation, like so many of Perl's
+of C<=>.  The <FH> read operation, like so many of Perl's
 functions and operators, can tell which context it was called in and
 behaves appropriately.  In general, the scalar() function can help.
 This function does nothing to the data itself (contrary to popular myth)
@@ -610,7 +617,7 @@ Why do you want to do that? :-)
 
 If you want to override a predefined function, such as open(),
 then you'll have to import the new definition from a different
-module.  See L<perlsub/"Overriding Builtin Functions">.  There's
+module.  See L<perlsub/"Overriding Built-in Functions">.  There's
 also an example in L<perltoot/"Class::Template">.
 
 If you want to overload a Perl operator, such as C<+> or C<**>,
@@ -765,7 +772,7 @@ before Perl has seen that such a package exists.  It's wisest to make
 sure your packages are all defined before you start using them, which
 will be taken care of if you use the C<use> statement instead of
 C<require>.  If not, make sure to use arrow notation (eg,
-C<Guru-E<gt>find("Samy")>) instead.  Object notation is explained in
+C<< Guru->find("Samy") >>) instead.  Object notation is explained in
 L<perlobj>.
 
 Make sure to read about creating modules in L<perlmod> and