[...]Under mod_perl2 the return value of print seems to be the number of bytes printed. I run across a legacy app (a registry script), that frequently used the following idiom:
[...]This behaviour is nearly impossible to notice, since the redirection will happen as usual. The resulting malfunctions are not trivial to debug, since the error results from two un(der)documented features, and the symptoms can be completely random.
However, this could be a thing worth mentioning in a "possible pitfalls" document.
Frankly I'm not sure what's the best solution here. We could make it return success and failure, but it will break consistency with other methods. Observe that the following methods all behave similarly:
http://perl.apache.org/docs/2.0/api/Apache/RequestIO.html#C_print_ http://perl.apache.org/docs/2.0/api/Apache/RequestIO.html#C_puts_ http://perl.apache.org/docs/2.0/api/Apache/RequestIO.html#C_printf_ http://perl.apache.org/docs/2.0/api/Apache/Filter.html#C_print_ http://perl.apache.org/docs/2.0/api/APR/Socket.html#C_send_
same goes for read() and recv()
http://perl.apache.org/docs/2.0/api/Apache/RequestIO.html#C_read_ http://perl.apache.org/docs/2.0/api/Apache/Filter.html#C_read_ http://perl.apache.org/docs/2.0/api/APR/Socket.html#C_recv_
I suppose in the case of CGI.pm the solution is very simple, fix the modperl case further to return success if 0 or more bytes returned (I can write a patch for CGI.pm unless you want to do that). Notice that mp2's print() croaks on failure (like most other mp2 methods) whereas perl's print() will silently fail. So the modperl's behavior is better if you ask me, since 99.999% users don't check the return value of print call.
Of course I'd prefer to document this in "possible pitfalls", but let's hear what others think.
As we plan to post mp2-RC1 now, there is not much time left for API changes.
-- __________________________________________________________________ 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
-- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html