perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Torsten Förtsch <torsten.foert...@gmx.net>
Subject Re: httpd24 (was Re: 2.0.9-dev)
Date Tue, 25 Jun 2013 14:21:43 GMT
On 24/06/13 19:36, Jan Kaluza wrote:
> Since there can't be conditionals in those files currently, it's impossible
> to have the same xs/* files for both httpd versions. The solution for this
> could be another "xs24" directory with httpd-2.4 xs files, or improving all
> the generators in lib/ModPerl to support something like #ifdef in those files.

You can actually do something similar to:

#_if_ $^O !~ /mswin/i
~apr_os_sock_get
#_else_
-apr_os_sock_get
#_end_

It's implemented in lib/ModPerl/MapUtil.pm in ModPerl::MapBase::readline.

Here is the syntax:

"if"

# _if_ CONDITION
...
# _elsif_ CONDITION
...
# _else_
...
# _end_

"unless":

# _unless_ CONDITION
...
# _elsif_ CONDITION
...
# _else_
...
# _end_

nested conditionals:

# _if_ CONDITION
...
  # _if_ CONDITION
  ...
  # _end_
...
# _end_

"eval"

# _eval_ CODE

like in

# _if_ $^O =~ /mswin/i
# _eval_ warn "Running on Windows"
# _end_

CODE and CONDITION is just perl code. But it must be one line. If you
require multi-line code blocks we can implement some kind of
continuation lines. But I think this should not be necessary.

Torsten

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Mime
View raw message