I'm thinking to make recv/send perlish, similar to read()/print()

  my $read  = $sock->recv($buf, $len);
  my $wrote = $sock->send($buf, $len);

the only difference will be that we will croak on error. I know I'm going to break someone's code but better early than later.

But ideally I'd just have this simple API:

  my $buf   = $sock->recv($len);
  my $wrote = $sock->send($buf);

since modifying the variable that you pass to the function is going to be very confusing to many users. We code in perl, not C.

In the first call you can check length of $buf, if you need to know how much was read.

In the second call, you don't need to pass the len argument. It's just silly to do, since we know it already, and it doesn't cost us anything to retrieve it from C.

I'm in favor of the latter API.

__________________________________________________________________
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