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/06/03 10:42:23 UTC

cvs commit: modperl-docs/src/docs/2.0/api/APR Error.pod

stas        2004/06/03 01:42:23

  Modified:    src/docs/2.0/api/APR Error.pod
  Log:
  add the lost strerror function
  
  Revision  Changes    Path
  1.5       +44 -0     modperl-docs/src/docs/2.0/api/APR/Error.pod
  
  Index: Error.pod
  ===================================================================
  RCS file: /home/cvs/modperl-docs/src/docs/2.0/api/APR/Error.pod,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -u -r1.4 -r1.5
  --- Error.pod	22 May 2004 02:03:26 -0000	1.4
  +++ Error.pod	3 Jun 2004 08:42:23 -0000	1.5
  @@ -129,6 +129,50 @@
   C<APR::Error> exception objects.
   
   
  +=head2 C<strerror>
  +
  +Convert APR error code to its string representation.
  +
  +  $error_str = APR::Error::strerror($rc);
  +
  +=over 4
  +
  +=item ret: C<$rc> ( C<L<APR::Const status
  +constant|docs::2.0::api::APR::Const>> )
  +
  +The numerical value for the return (error) code
  +
  +=item ret: C<$error_str> ( string )
  +
  +The string error message corresponding to the numerical value inside
  +C<$rc>.  (Similar to the C function C<strerror(3)>)
  +
  +=item since: 1.99_14
  +
  +=back
  +
  +Example:
  +
  +Try to retrieve the bucket brigade, and if the return value doesn't
  +indicate success or end of file (usually in protocol handlers) die,
  +but give the user the human-readable version of the error and not just
  +the code.
  +
  +  my $rc = $c->input_filters->get_brigade($bb_in,
  +                                          Apache::MODE_GETLINE);
  +  if ($rc != APR::SUCCESS && $rc != APR::EOF) {
  +      my $error = APR::Error::strerror($rc);
  +      die "get_brigade error: $rc: $error\n";
  +  }
  +
  +It's probably a good idea not to omit the numerical value in the error
  +message, in case the error string is generated with non-English
  +locale.
  +
  +
  +
  +
  +
   =head1 See Also
   
   L<mod_perl 2.0 documentation|docs::2.0::index>.
  
  
  

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