Ticket #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: |
Description
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,
'Demo::App',
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
Note: See
TracTickets for help on using
tickets.

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.