Stas Bekman wrote:
todays Joe patch triggered my interest to further test the socket set/get options, just to discover that opt_get doesn't work at all. So I made it working and made both APIs perlish, croacking in case of the failure instead of returning status. Sounds good?
I like the idea of returning the value instead of the status - that's something that we should probably enforce more consistently than we do.
So, we can still change it. Just name the API that should be changed.
I'm not entirely convinced that croak is a good thing. consider that perl's native getsockopt() and setsockopt() both return undef on error rather than die.
Neither do I.
and I know we've discussed this before, but I really don't like the idea of
croaking at request time - for configuration things it's ok, but the vast
majority of file IO and other operations in perl proper don't die: open,
read, most of the IO:: stuff, etc. in other words, people expect to check
return values for these things instead of needing eval{} so we're throwing
them a curve every time we croak instead.
Agreed, but first, you probably also agree that most people won't check it and usually if there is a socket problem, you can't do much, and there is no point to eval. Most likely you will want to die.
Second, let's say we don't croak and return undef. We need to set a consistent variable with the error message. As you saw I've failed to convince p5p to allow us to peruse $!. And $@ is not appropriate, we have no other choce but to use some other variable. So what should it be? $Apache::err and $Apache::errstr, ala $DBI::errstr. Or should there be a separate error variables for APR and Apache, since APR eventually could be used outside mod_perl?
Also going back to my patch, what do you think about opt_set returning an old value. I've coded explicitly to get that old value before setting the new one. That sounds Perlish, but I'm not sure whether it's worth the overhead.
__________________________________________________________________
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]
