perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Torsten Förtsch <>
Subject [RFC] How to implement stuff that makes sense only under certain conditions
Date Sat, 08 May 2010 13:48:02 GMT

as you perhaps know I have recently added APR::Socket->fileno. But on Windows 
this function doesn't do anything useful.

Later I have added the C<#_if_ ...> mini language to ModPerl::MapUtil, see

The latter was caused to make modules like ModPerl::Interpreter possible that 
make sense only if perl has been compiled to support multiple interpreters.


Now I think in cases like APR::Socket->fileno it might be better to leave it 
unimplemented when it cannot do anything useful. That would mean the user 
would see something like this in the error_log:

[Sat May 08 14:19:39 2010] [error] [client] Can't locate object 
method "fileno" via package "APR::Socket" at /home/r2/work/mp2/trunk/clean-
trunk-prefork/t/response/TestAPR/ line 43.\n

Now the user of a module that uses something that is not implemented under 
certain conditions can ask the author what that means instead of silently 
wondering what he did wrong.

My question in general is

* is it better to implement something like
  C<< return -1 if $^O eq 'win32'; do_the_real_stuff >>

* or leave it conditionally unimplemented like this:
Index: xs/maps/
+#_if_ $^O ne 'linux'
  mpxs_APR__Socket_fileno | | apr_socket_t *:socket
+#_if_ $^O ne 'linux'


Torsten Förtsch

Need professional modperl support? Hire me! (

Like fantasy?

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message