[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]
Tk800.018 patch for possible perl 5.005_63 RE bug
On Wed, 26 Jan 2000, Nick Ing-Simmons wrote:
> David Dyck <dcd@tc.fluke.com> writes:
> >I didn't look at the archives before I posted the following mail,
> >but do you know what else is known not to work after applying the
> >following patch?
>
> Regular expressions of the form m#(?:^|/)(\w+)#
> i.e. word at start of string or after a /.
> This messes up appname setting, and one or two other things.
Thank you Nick,
(I've cc'ed p5p - maybe they can add some test cases
to perl for this)
I've used Perl since perl version 3, but I've never put
the ^ in the middle like that -- I'm still learning new
things. (I just searched man perlre, and all the ^ characters
that are not in a range or character class seem to be a the beginning of
the match, no wait, there is one in the `(?!pattern)' section
but thats the |^, not ^|
Would this alternative re work instead:
m#^(?:.*/)?(\w+)#
I don't see a test case form
(?:^|/)(\w+)
The closest test case where I could find an '|' next to '^' was:
(^|x)(c) ca y $2 c
in perl's t/op/re_tests
Is the failing re you refering to in Tk800.018/Tk/CmdLine.pm as:
$name = $1 if (($0 =~ m/(?:^|[\/\\])([\w-]+)(?:\.\w+)?$/) && ($1 ne '-e'));
where $0 is t/widget.t
Here's a test case that matches with older perls (5.005_57),
but doesn't match with
perl -le '$0="t/widget.t"; $name="unmatched";
$name = $1 if (($0 =~ m/(?:^|[\/\\])([\w-]+)(?:\.\w+)?$/) && ($1 ne "-e"));
print "$name";'
If so I modified the re to hack around and it passes make test now (w.r.t. widget)
$name = $1 if (($0 =~ m/^(?:.*[\/\\])?([\w-]+)(?:\.\w+)?$/) && ($1 ne "-e"));
--- ./Tk/CmdLine.pm.orig Sat Jan 15 04:00:33 2000
+++ ./Tk/CmdLine.pm Wed Jan 26 10:55:36 2000
@@ -31,7 +31,7 @@
my $class = ref($this) || $this;
my $name = 'pTk';
- $name = $1 if (($0 =~ m/(?:^|[\/\\])([\w-]+)(?:\.\w+)?$/) && ($1 ne '-e'));
+ $name = $1 if (($0 =~ m/^(?:.*[\/\\])?([\w-]+)(?:\.\w+)?$/) && ($1 ne '-e'));
my $self = {
name => $name,
- Follow-Ups from:
-
Nick Ing-Simmons <nik@tiuk.ti.com>
[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]