in reply to Worrying regex issue with 5.8.0

This doesn't appear to be a perl issue, but rather a Data::Dumper issue.

Why is Data::Dumper involved anyway?

use Data::Dumper; my $re_bad = qr'@@([A-Z$#@_#]*) (?! [A-Za-z0-9$#@_] )'x; print Dumper $re_bad; print "\n\n\n"; print $re_bad; __END__ $VAR1 = qr/(?x-ism:@@([A-Z$#@_#]*) (?! [A-Za-z0-9$#@_] ))/; (?x-ism:@@([A-Z$#@_#]*) (?! [A-Za-z0-9$#@_] ))

____________________________________________________
** The Third rule of perl club is a statement of fact: pod is sexy.

Replies are listed 'Best First'.
Re: Re: Worrying regex issue with 5.8.0
by ruscoekm (Monk) on Nov 15, 2002 at 08:48 UTC

    Well, from your output, you appear not to get any spurious characters anyway.

    When I said above that Data::Dumper was not the issue, what I meant was that I was just using it to display the output. I originally observed the problem because the characters added to my regex were **, which caused the regex to be invalid (luckily, or I might not have spotted it for a while).

    However, Data::Dumper may yet be involved. When I run the following code:

    use Data::Dumper; my $re_bad = qr'xx([A-Z$#@_!]*) (?! [A-Za-z0-9$#@_] )'x; print $re_bad;

    the output is:

    (?x-ism:xx([A-Z$#@_!]*) (?! [A-Za-z0-9$#@_] )# )

    Note the spurious hash (or pound, if you prefer :-) at the end. Given the following code:

    my $re_bad = qr'xx([A-Z$#@_!]*) (?! [A-Za-z0-9$#@_] )'x; print $re_bad;

    the output is:

    (?x-ism:xx([A-Z$#@_!]*) (?! [A-Za-z0-9$#@_] ) )

    However, this does not yet prove that Data::Dumper is the culprit. Given the sporadic nature of the symptoms, it may well be that simply using any module of the right "size" will produce the error.

    Kevin

Re: Re: Worrying regex issue with 5.8.0
by ruscoekm (Monk) on Nov 15, 2002 at 10:35 UTC

    Ok, latest summary...

    It appears that the error does not occur unless both Data::Dumper and /x are present. Since the error is so sporadic, it is hard to be sure.

    NB Just avoiding the use of Data::Dumper (say by using Dumpvalue instead) is not an option, since many CPAN modules which I am using themselves use Data::Dumper.

    I will hang on a bit longer, to see if anybody spots anything else, then submit a bug report.

    Cheers, Kevin