I'm guessing the problem is the newline in the regex. If you want it to
match across multiple lines, I think the /ms modifiers should do the trick.
if ( m/{.*}[Oo]rder deny,allow(.*)\n(.*)[Dd]eny from all(.*)/ms) {
NOTE: I haven't tried this myself!:)
failing that,
$ perldoc perlre
may be of help.
On Thu, Jul 14, 2016 at 3:50 PM, Darryl Philip Baker <
[email protected]> wrote:
> While not truly a beginner it feels that way after not doing anything
> substantial in Perl in many years.
>
> I currently need a program to take Apache HTTPD configuration files in
> HTTPD 2.2 syntax used in current production and convert them to HTTPD 2.4
> syntax in future production. I will need to do this many times weekly until
> we cut over to the new systems. My first challenge is converting the
> permissions syntax:
> Order deny,allow
> Deny from all
> To
> Require all denied
> And similar transformations. I was able to make this modification if I set
> $/ = undef and look at the file as a whole. My problem is I really want to
> process the file line by line to remove several <IfDefine BLAH> ...
> </IfDefine> blocks which may have other conditional code blocks contained
> within them. I have considered using two separate scripts and a two pass
> solution but there is a part of me which would rather have a single script
> do it all in one pass.
>
> My current attempt, after several tries, is:
> if ( m/{.*}[Oo]rder deny,allow(.*)\n(.*)[Dd]eny from all(.*)/) {
> print "\tRequire all denied\n";
> next;
> }
> While not causing syntax errors it is not doing what I want either. I am
> probably using the 'm/' incorrectly and need your help.
>
> Darryl Baker
>
> --
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> http://learn.perl.org/
>
>
>
--
Andrew Solomon
Mentor@Geekuni http://geekuni.com/
http://www.linkedin.com/in/asolomon