$ perl -E 'my $re = qr{(?x: PAT )}; say $re'
(?^u:(?x: PAT ))
As, ^ is short for d-imnsx, and u overrides d, I suppose that's
effectively equivalent to something like:
(?d-imnsx:(?u-d:(?x: PAT )))
Also on 5.24:
$ perl -E 'my $re = qr{ PAT }msx; say $re'
(?^umsx: PAT )
Which, given the same logic, would be:
(?d-imnsx:(?umsx-d: PAT ))
Of course, d can't actually be turned off like that (i.e. -d is illegal):
$ perl -E 'my $re = qr{(?d-imnsx:(?u-d:(?x: PAT )))}'
Regexp modifier "d" may not appear after the "-" in regex; ...
$ perl -E 'my $re = qr{(?d-imnsx:(?umsx-d: PAT ))}'
Regexp modifier "d" may not appear after the "-" in regex; ...
I'm just making the point that both qr{(?x: PAT )} and qr{ PAT }msx
end up with nested (?:...) constructs and both have modifiers turned on and off at various points.
"... it occurred to me to ask if you were aware that qr// effectively wraps its object ..."
Yes, I was aware of it; and something I learned a long time ago (2008, I think).
I came across a situation where compiled regexes were being stored, retrieved and recompiled.
This was under 5.8 (I think), and the modifiers were somewhat different, but the basic scenario was:
$ perl -E 'my $re = qr{ PAT }msx; say $re; $re = qr{ $re }msx; say $r
+e; $re = qr{ $re }msx; say $re; say "..."'
(?^umsx: PAT )
(?^umsx: (?^umsx: PAT ) )
(?^umsx: (?^umsx: (?^umsx: PAT ) ) )
...
I imagine you're familiar with the doco but, for others who might be interested,
see these sections of perlre:
"Modifiers";
"(?adlupimnsx-imnsx)";
"(?:pattern)".
|