Joe Schaefer wrote:
Stas Bekman <[EMAIL PROTECTED]> writes:


Joe Schaefer wrote:

Stas Bekman <[EMAIL PROTECTED]> writes:


Stas Bekman wrote:


It makes the socket read/write loops similar to filter ones:
  while ($socket->recv(my $buff, BUFF_LEN)) {
      $socket->send($buff);
  }

Sounds like a great idea, Stas!

+1. It'd be cool if Apache::(Request|Cookie) also took advantage of APR::Error.

It should be trivial to do. just replace Perl_croak calls with modperl_croak(aTHX_ rc, "function name"); and require mod_perl 1.99_14 as a minimal version. that's ofcourse for those places where you have an rc (which must be apr_status_t).


No good- modperl_croak() is part of modperl.so.  apreq-dev can either

  1) reimplement it in apreq_xs_postperl.h (maintenance?),
  2) call Apache::Error::new() from XS (slow when compared to modperl_croak()),
  3) get mp2 to export that function (eg. in a static library) along with
     the other APR:: stubs currently provided by modperl.so.

It will be a part of APR as soon as Randy gets things working on win32. The patch that I've posted some time ago (and which works fine on unix) has perl_croak decoupled from mod_perl.so. So I guess you just need to wait till that happens.


I'm also going to add a wrapper to replace the crafty

 if (ref $@ eq 'Apache::Error' && $@ == APR::TIMEUP) { ... }

with:

 if (APR::Error::foo($@, APR::TIMEUP)) { ... }

Not sure how to call that wrapper, APR::Error::check()?


Off the top of my head I'd s/foo/isa/ and use something
like

  package APR::Error;
  sub isa {
    my ($obj, $error_type) = @_;
    return unless UNIVERSAL::isa($obj, __PACKAGE__);
    return $obj == $error_type;
  }

I thought to call it isa(), but I thought it'll be confusing with UNIVERSAL::usa.

but somehow I'd rather be attaching handlers to exception classes (like Java & C# do), not dispatching
on the value of $@ directly.

Example?


-- __________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to