Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the PPIx-EditorTools CPAN distribution.

Report information
The Basics
Id: 60042
Status: open
Priority: 0/
Queue: PPIx-EditorTools

People
Owner: ahmad.zawawi [...] gmail.com
Requestors: DDUMONT [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.09
Fixed in: (no value)



Subject: Lexical variable subsitution should be limited to enclosing block
Hello I've used Padre to create a new temp variable within a subroutine. The replacement did work well in this subroutine. Unfortunately, the new variable was also introduced in all remaining subs. I guess that PPIx-EditorTools should stop lexical variable replacement when going out of the scope of the variable declaration. I hope this makes sense. If it doesn't, I'll provide an example. All the best.
Subject: Re: [rt.cpan.org #60042] Lexical variable subsitution should be limited to enclosing block
Date: Mon, 9 Aug 2010 14:16:52 -0400
To: bug-PPIx-EditorTools [...] rt.cpan.org
From: Mark Grimes <mgrimes [...] cpan.org>
On Tue, Aug 3, 2010 at 10:42 AM, Dominique Dumont via RT <bug-PPIx-EditorTools@rt.cpan.org> wrote: Show quoted text
> Tue Aug 03 10:42:35 2010: Request 60042 was acted upon. > Transaction: Ticket created by DDUMONT >       Queue: PPIx-EditorTools >     Subject: Lexical variable subsitution should be limited to enclosing block >   Broken in: 0.09 >    Severity: Normal >       Owner: Nobody >  Requestors: DDUMONT@cpan.org >      Status: new >  Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=60042 > > > snip... > I guess that PPIx-EditorTools should stop lexical variable replacement > when going out of the scope of the variable declaration.
I believe you are correct. Either the temporary variable needs to be inserted in a lexical scope that includes all of the replacements, or the replacements should be limited to the current block. I would opt for the later. The attached patch adds a test for this (in a TODO block). I haven't had a chance to look into implementing the fix. I think the Padre team (who keeps the PPIx::EditorTools repository) uses Trac (http://padre.perlide.org/trac/) for bug reports. This should probably be posted there and info about where to report bugs should be added to the perldoc.

Message body is not shown because sender requested not to inline it.

Applied the four TODO tests. Now I am going to try to fix it. Thanks, Ahmad M. Zawawi azawawi
Found the problem, we're replacing all the stuff in a regular expression... my $code = join( '', @code ); $code =~ s/\Q$expr\E/$varname/gm; $code =~ s/\Q$place_holder\E/$expr/gm; Fixing... :)
Le Ven 19 Nov 2010 12:07:02, AZAWAWI a écrit : Show quoted text
> Fixing... :)
Finding the limits of the enclosing block is going to be fun ... ;-)