You are viewing a plain text version of this content. The canonical link for it is here.
Posted to docs-cvs@perl.apache.org by st...@apache.org on 2004/04/29 19:56:30 UTC

cvs commit: modperl-docs/src/docs/2.0/api/ModPerl Util.pod

stas        2004/04/29 10:56:30

  Modified:    src/docs/2.0/api/ModPerl Util.pod
  Log:
  document the exit-in-eval-block caveat
  
  Revision  Changes    Path
  1.6       +34 -0     modperl-docs/src/docs/2.0/api/ModPerl/Util.pod
  
  Index: Util.pod
  ===================================================================
  RCS file: /home/cvs/modperl-docs/src/docs/2.0/api/ModPerl/Util.pod,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -u -r1.5 -r1.6
  --- Util.pod	10 Mar 2004 21:44:12 -0000	1.5
  +++ Util.pod	29 Apr 2004 17:56:30 -0000	1.6
  @@ -94,6 +94,40 @@
   
   The original C<exit()> is still available via C<CORE::exit()>.
   
  +C<ModPerl::Util::exit> is implemented as a special C<die()> call,
  +therefore if you call it inside C<eval BLOCK> or C<eval "STRING">,
  +while an exception is being thrown, it is caught by C<eval>. For
  +example:
  +
  +  exit;
  +  print "Still running";
  +
  +will not print anything. But:
  +
  +  eval {
  +     exit;
  +  }
  +  print "Still running";
  +
  +will print I<Still running>. So you either need to check for the
  +exception:
  +
  +  eval {
  +     exit;
  +  }
  +  exit if $@;
  +  print "Still running";
  +
  +or use C<CORE::exit()>:
  +
  +  eval {
  +     CORE::exit;
  +  }
  +  print "Still running";
  +
  +and nothing will be printed. The problem with the latter is the
  +current process (or a Perl Interpreter) will be killed; something that
  +you really want to avoid under mod_perl.
   
   
   =head1 See Also
  
  
  

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