-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Substitution issue for -L in Makefile.PL on HPUX #492
Comments
Looks good. I first thought about removing the match variable |
It looks like you figured out that the (?:^|\s) would match a space but it
would not restore it in the result. I think what you are thinking of is the
zero-width positive lookbehind assertion syntax.
"(?<=pattern)"
"\K"
A zero-width positive lookbehind assertion. For example,
"/(?<=\t)\w+/" matches a word that follows a tab, without
including the tab in $&. Works only for fixed-width lookbehind.
There is a special form of this construct, called "\K"
(available since Perl 5.10.0), which causes the regex engine to
"keep" everything it had matched prior to the "\K" and not
include it in $&. This effectively provides variable-length
lookbehind. The use of "\K" inside of another lookaround
assertion is allowed, but the behaviour is currently not well
defined.
For various reasons "\K" may be significantly more efficient
than the equivalent "(?<=...)" construct, and it is especially
useful in situations where you want to efficiently remove
something following something else in a string. For instance
s/(foo)bar/$1/g;
can be rewritten as the much more efficient
s/foo\Kbar//g;
I wasn't sure how well this worked with matching the beginning of the
string so I opted for what I knew worked.
So it looks like we just need to add the \K to your version.
($args{uc $_} = $Config{$_}) =~ s/(?:^|\s)\K-L/$lp -L/ for qw(lddlflags
ldflags);
Yup it works too:
$ perl -e ***@***.***) { print "$_\n"; s/(?:^|\s)\K-L/-LBBB -L/g; print
"$_\n"; }' -- '-La-LP64 -Lc -Ld-LP64'
-La-LP64 -Lc -Ld-LP64
-LBBB -La-LP64 -LBBB -Lc -LBBB -Ld-LP64
Max Vohlken (he/him)
Senior Software Engineer
ClearCase/VersionVault and ClearQuest/Compass
HCLSoftware <https://hcl-software.com/>
Ardsley, New York
***@***.***
Mobile: +1-781-640-2170
…On Mon, Dec 2, 2024 at 11:44 AM Heikki Vatiainen ***@***.***> wrote:
Here's one more improvement that adds non-capturing match with ?::
($args{uc $_} = $Config{$_}) =~ s/(?:^|\s)-L/$lp -L/ for qw(lddlflags
ldflags);
As far as I can tell, it does the same thing but without capture or
capture variable $1. Does the above work for you too?
—
Reply to this email directly, view it on GitHub
<#492 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AIZRVGFUNGZ446JFHEGYM632DSE7DAVCNFSM6AAAAABSBBKSJWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMJSGEYDKMRRGY>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
On HPUX the platform identifier is IA64.ARCHREV_0-thread-multi-LP64. A substitution for -L in the Makefile.PL incorrectly replaces the -L in -LP64 when the platform identifier is on the linker command line. An example is the
-Wl,+b/usr/lib/perl5/5.26.3/IA64.ARCHREV_0-thread-multi-LP64/CORE
option to add the CORE directory to the embedded runpath.The offending line is:
($args{uc $_} = $Config{$_}) =~ s/-L/$lp -L/ for qw(lddlflags ldflags);
The s/-L/ isn't specific enough. The desire is to match the -L linker argument. So a better match is to look for -L after a space or at the beginning of the value. So I propose this improvement.
($args{uc $_} = $Config{$_}) =~ s/(^|\s)-L/$1$lp -L/ for qw(lddlflags ldflags);
The text was updated successfully, but these errors were encountered: