in reply to Dumping regexp for Perl versions earlier than 5.14
I feel like I'm missing something (well, I have zero experience in creating CPAN modules, so that may be where I'm wrong) but I think you may be trying too hard.
First, I don't get how compiling the regexes at the program build-time is better. Perl being an interpreted language, there is a build-time each time you start a program, so doing something during build-time or at the beginning of run-time is equivalent time-wise. And even if you didn't use qred regexes, later version of perl have become quite good at guessing when not to recompile regexes.
Second, and I already have a few answers in mind for this one, (since I already feel like I'm being wrong somewhere, I'll just keep going) if the stringification compiled regex doesn't suit your needs, why don't you dump the pattern before compilation (something like $pat = qq/REGEX/; say $pat; $reg = qr/$pat/i;)? The first of the answers that come to mind being "It's not just the pattern, but the modifiers that must be compared".
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Dumping regexp for Perl versions earlier than 5.14
by AnomalousMonk (Archbishop) on Oct 03, 2014 at 14:04 UTC | |
by Eily (Monsignor) on Oct 03, 2014 at 14:35 UTC | |
|
Re^2: Dumping regexp for Perl versions earlier than 5.14
by perlancar (Hermit) on Oct 03, 2014 at 14:46 UTC | |
|
Re^2: Dumping regexp for Perl versions earlier than 5.14
by perlancar (Hermit) on Oct 03, 2014 at 14:56 UTC |