Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the PPI CPAN distribution.

Report information
The Basics
Id: 16674
Status: resolved
Priority: 0/
Queue: PPI

People
Owner: Nobody in particular
Requestors: awigley [...] realestate.com.au
Cc:
AdminCc:

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



Subject: PPI::Token::Quote::Double->interpolations
Distribution: PPI-1.104 (and looks like PPI-1.108 has the same issues) Perl version: v5.6.1 OS vendor/version: FreeBSD 4.8-RELEASE-p17 The method PPI::Token::Quote::Double->interpolations is displaying buggy behaviour in that it is reporting strings which do have interpolations to not be. I believe is due to this code in PPI/Token/Quote/Double.pm: 64 sub interpolations { ... 67 # Are there any unescaped $things in the string 68 !! $self->content =~ /(?<!\\)(?:\\\\)*\$/; 69 } Firstly, the ! operator has a higher precedence than the =~ operator, which means that line 68 is treated by perl as if it was the same as: (!! $self->content) =~ /(?<!\\)(?:\\\\)*\$/; This is fixed by putting brackets around the =~ operator and its operands: !! ($self->content =~ /(?<!\\)(?:\\\\)*\$/); Secondly, arrays may also be interpolated into strings, eg: @fruit = qw(apples pears bananas); print "The fruit are @fruit"; So you also need to check for the @ sigil as well as $. Interpolation also occurs with escape sequence such as \t (tab), \n (newline), \033 (octal), \x1b (hex), \N{name}(named char), as well as a bunch of others. Regards, Aaron
From: adamk [...] cpan.org
Show quoted text
> !! ($self->content =~ /(?<!\\)(?:\\\\)*\$/);
Fixed, and added unit test to catch regression Show quoted text
> Secondly, arrays may also be interpolated into strings, eg: > > @fruit = qw(apples pears bananas); > print "The fruit are @fruit";
Crap, yes, added. Show quoted text
> So you also need to check for the @ sigil as well as $. Interpolation > also occurs with escape sequence such as \t (tab), \n (newline), > \033 (octal), \x1b (hex), \N{name}(named char), as well as a bunch > of others.
Escape sequences aren't interpolations though, they are part of the encoding. Which is why the 'non-interpolating string' has the escape sequences \\ and \' in it. Not adding escape sequences, but the other two will get dealt with and regresion-tested