perl-docs-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject cvs commit: modperl-docs/src/docs/1.0/guide Changes.pod porting.pod
Date Wed, 17 Apr 2002 04:34:45 GMT
stas        02/04/16 21:34:45

  Modified:    src/docs/1.0/guide Changes.pod porting.pod
  Log:
    o bring the warnings section up to date with perl 5.6 (Rafael
      Garcia-Suarez)
  
    o cover the 5.6's CHECK block in addition to INIT (Rafael
      Garcia-Suarez)
  Submitted by:	Rafael Garcia-Suarez <rgarciasuarez@free.fr>
  
  Revision  Changes    Path
  1.11      +6 -0      modperl-docs/src/docs/1.0/guide/Changes.pod
  
  Index: Changes.pod
  ===================================================================
  RCS file: /home/cvs/modperl-docs/src/docs/1.0/guide/Changes.pod,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- Changes.pod	17 Apr 2002 02:03:03 -0000	1.10
  +++ Changes.pod	17 Apr 2002 04:34:45 -0000	1.11
  @@ -16,6 +16,12 @@
     o add a new section presenting a hackish solution for libraries
       collision, via do() or %INC mangling.
   
  +  o bring the warnings section up to date with perl 5.6 (Rafael
  +    Garcia-Suarez)
  +
  +  o cover the 5.6's CHECK block in addition to INIT (Rafael
  +    Garcia-Suarez)
  +
   * guide::troubleshooting
   
     o solution to the 'readdir()/opendir() not working' problem (Louis
  
  
  
  1.7       +31 -29    modperl-docs/src/docs/1.0/guide/porting.pod
  
  Index: porting.pod
  ===================================================================
  RCS file: /home/cvs/modperl-docs/src/docs/1.0/guide/porting.pod,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- porting.pod	15 Apr 2002 06:56:39 -0000	1.6
  +++ porting.pod	17 Apr 2002 04:34:45 -0000	1.7
  @@ -2697,19 +2697,21 @@
   This is usually useful when some server wide cleanup should be
   performed when the server is stopped or restarted.
   
  -=head1 CHECK Blocks
  +=head1 CHECK And INIT Blocks
   
  --- available since perl5.6.0
  -
  -This block runs when compilation is complete, but before the program
  -starts. B<CHECK> can mean "checkpoint" or "double-check" or even jus
  -"stop").
  -
  -Perl only calls B<CHECK> blocks during perl_parse(), which mod_perl
  -calls once at startup time.  Therefore B<CHECK> blocks don't work for
  -the same reason this doesn't:
  +These blocks run when compilation is complete, but before the program
  +starts. B<CHECK> can mean "checkpoint" or "double-check" or even just
  +"stop". B<INIT> stands for "initialization". The difference is subtle;
  +B<CHECK> blocks are run just after the compilation ends, B<INIT> just
  +before the runtime begins. (Hence the C<-c> command-line flag to perl
  +runs B<CHECK> blocks but not B<INIT> blocks.)
  +
  +Perl only calls these blocks during perl_parse(), which mod_perl calls
  +once at startup time.  Therefore B<CHECK> and B<INIT> blocks don't work
  +for the same reason these don't:
   
     % perl -e 'eval qq(CHECK { print "ok\n" })'
  +  % perl -e 'eval qq(INIT  { print "ok\n" })'
   
   =head1 Command Line Switches (-w, -T, etc)
   
  @@ -2740,50 +2742,50 @@
   in C<httpd.conf> will turn warnings B<On> in any script.
   
   You can then fine tune your code, turning warnings B<Off> and B<On> by
  -setting the C<$^W> variable in your scripts.
  +using the C<warnings> pragma in your scripts (or by setting the C<$^W>
  +variable, if you prefer to be compatible with older, pre-5.6, perls).
   
   =item * Locally to a script
   
     #!/usr/bin/perl -w
   
   will turn warnings B<On> for the scope of the script.  You can turn
  -them B<Off> and B<On> in the script by setting the C<$^W> variable as
  -noted above.
  +them B<Off> and B<On> in the script with C<no warnings;> and C<use
  +warnings;> as noted above.
   
   =item * Locally to a block
   
   This code turns warnings mode B<On> for the scope of the block.
   
     {
  -    local $^W = 1;
  +    use warnings;
       # some code
     }
  -  # $^W assumes its previous value here
  +  # back to the previous mode here
   
   This turns it B<Off>:
   
     {
  -    local $^W = 0;
  +    no warnings;
       # some code
     }
  -  # $^W assumes its previous value here
  -
  -Note, that if you forget the C<local> operator this code will affect the
  -child processing the current request, and all the subsequent requests
  -processed by that child.  Thus
  +  # back to the previous mode here
   
  -  $^W = 0;
  +This turns B<Off> only the warnings from the listed categories :
  +(warnings categories are explicited in the C<perldiag> manpage.)
   
  -will turn the warnings I<Off>, no matter what.
  +  {
  +    no warnings qw(uninitialized unopened);
  +    # some code
  +  }
  +  # back to the previous mode here
   
  -If you want to turn warnings I<On> for the scope of the whole file, as
  -in the previous item, you can do this by adding:
  +If you want to turn warnings I<On> for the scope of the whole file,
  +you can do this by adding:
   
  -  local $^W = 1;
  +  use warnings;
   
  -at the beginning of the file. Since a file is effectively a block,
  -file scope behaves like a block's curly braces C<{ }> and C<local $^W>
  -at the start of the file will be effective for the whole file.
  +at the beginning of the file.
   
   =back
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: docs-cvs-unsubscribe@perl.apache.org
For additional commands, e-mail: docs-cvs-help@perl.apache.org


Mime
View raw message