Skip Menu |
 

This queue is for tickets about the Dist-Zilla-Plugin-OptionalFeature CPAN distribution.

Report information
The Basics
Id: 86989
Status: resolved
Priority: 0/
Queue: Dist-Zilla-Plugin-OptionalFeature

People
Owner: Nobody in particular
Requestors: dolmen [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: (no value)



Subject: Usage of $`
Download (untitled) / with headers
text/plain 1.4k
Not everyone works with perl 5.18 that has $` cost fixed. From perlre: WARNING: Once Perl sees that you need one of $&, "$`", or "$'" anywhere in the program, it has to provide them for every pattern match. This may substantially slow your program. Perl uses the same mechanism to produce $1, $2, etc, so you also pay a price for each pattern that contains capturing parentheses. (To avoid this cost while retaining the grouping behaviour, use the extended regular expression "(?: ... )" instead.) But if you never use $&, "$`" or "$'", then patterns without capturing parentheses will not be penalized. So avoid $&, "$'", and "$`" if you can, but if you can't (and some algorithms really appreciate them), once you've used them once, use them at will, because you've already paid the price. As of 5.005, $& is not so costly as the other two. As a workaround for this problem, Perl 5.10.0 introduces "${^PREMATCH}", "${^MATCH}" and "${^POSTMATCH}", which are equivalent to "$`", $& and "$'", except that they are only guaranteed to be defined after a successful match that was executed with the "/p" (preserve) modifier. The use of these variables incurs no global performance penalty, unlike their punctuation char equivalents, however at the trade-off that you have to tell perl when you want to use them. -- Olivier Mengué - http://perlresume.org/DOLMEN
Subject: Re: [rt.cpan.org #86989] Usage of $`
Date: Wed, 17 Jul 2013 08:05:12 -0700
To: Olivier Mengué via RT <bug-Dist-Zilla-Plugin-OptionalFeature [...] rt.cpan.org>
From: Karen Etheridge <ether [...] cpan.org>
Download (untitled) / with headers
text/plain 346b
On Wed, Jul 17, 2013 at 05:06:58AM -0400, Olivier Mengu? via RT wrote: Show quoted text
> Not everyone works with perl 5.18 that has $` cost fixed.
I thought about that problem, but this is just a plugin that is run at build time -- it's not something that will hit the user at runtime. Still, I can have a tab at rewriting the regexp, now that I've slept. :)
$` is replaced with ${^PREMATCH}. thanks for reviewing my code :)
Download (untitled) / with headers
text/plain 853b
Le 2013-07-17 17:05:32, ETHER a écrit : Show quoted text
> On Wed, Jul 17, 2013 at 05:06:58AM -0400, Olivier Mengu? via RT wrote:
> > Not everyone works with perl 5.18 that has $` cost fixed.
> > I thought about that problem, but this is just a plugin that is run at > build time -- it's not something that will hit the user at runtime.
The user of the distribution is not the only one that matters. The dzil user (the developer) counts too. $` usage impacts every module compiled after your plugin. You can run "perl -d:TraceUse -S dzil test" to see how many modules are compiled after your plugin (the first column of the Devel::TraceUse output is the module load order). So this has an impact on the runtime of dzil itself, especially as I'm trying to fix plugins to delay the loading of their dependencies. -- Olivier Mengué - http://perlresume.org/DOLMEN
Download (untitled) / with headers
text/plain 271b
Le 2013-07-17 17:14:47, ETHER a écrit : Show quoted text
> $` is replaced with ${^PREMATCH}. thanks for reviewing my code :)
I've not yet seen your fix. Did you push it? Don't forget to add a dependency on perl 5.10 for your plugin. -- Olivier Mengué - http://perlresume.org/DOLMEN
Subject: Re: [rt.cpan.org #86989] Usage of $`
Date: Thu, 18 Jul 2013 09:01:38 -0700
To: Olivier Mengué via RT <bug-Dist-Zilla-Plugin-OptionalFeature [...] rt.cpan.org>
From: Karen Etheridge <ether [...] cpan.org>
Download (untitled) / with headers
text/plain 553b
On Thu, Jul 18, 2013 at 04:47:55AM -0400, Olivier Mengu? via RT wrote: Show quoted text
> Queue: Dist-Zilla-Plugin-OptionalFeature > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=86989 > > > Le 2013-07-17 17:14:47, ETHER a écrit :
> > $` is replaced with ${^PREMATCH}. thanks for reviewing my code :)
> > I've not yet seen your fix. Did you push it?
Oops, pushed. Show quoted text
> Don't forget to add a dependency on perl 5.10 for your plugin.
Yep, [MinimumPerl] properly picked that up. (I'm half-expecting another ticket now for "doesn't work on 5.8.8" :D)


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.