Opened 10 years ago

Last modified 9 years ago

#890 new defect

"Introduce Temporary Variable" need to be fixed

Reported by: jagd Owned by:
Priority: minor Milestone:
Component: Refactoring Perl 5 Version: 0.58
Keywords: Introduce Temporary Cc:


This is a code piece from the Wx examples, just put the cursor there and click Refactor->Introduce Temporary Variable :

sub new {
	my ($class) = @_;
#<-------- CURSOR HERE
	my $self = $class->SUPER::new(
		undef, -1,
		wxDefaultPosition, wxDefaultSize,

	my $button = Wx::Button->new( $self, -1, "Press here" );

	EVT_BUTTON( $self, $button, sub { print "button pressed\n" } );

	$self->SetSize( $button->GetSizeWH );

	return $self;

Change History (3)

comment:1 Changed 10 years ago by waxhead

OK, a quick look through the code shows this is done by PPIx::EditorTools::IntroduceTemporaryVariable?.

Reading the perldoc though it states:

Given a region of code within a statement, replaces all occurrences of
that code with a temporary variable. Declares and initializes the
temporary variable right above the statement that included the
selected expression.

Which if you look at the code example, it's doing what the above says.

I'm not sure if this is a problem of implementation or user expectation.

comment:2 Changed 10 years ago by waxhead

  • Priority changed from major to minor

I'm dropping the priority to minor for now too. Feel free to bump it back up.

comment:3 Changed 9 years ago by szabgab

  • Component changed from advanced perl tools to Refactoring Perl 5
Note: See TracTickets for help on using tickets.