Opened 5 years ago

Closed 5 years ago

Last modified 4 years ago

#531 closed enhancement (fixed)

extract subroutine

Reported by: rhebus Owned by: rhebus
Priority: major Milestone: Satisfy all the requirements of PerlMonks
Component: Refactoring Perl 5 Version: 0.45
Keywords: Cc:

Description

Brief description here: http://www.eigenstate.net/perl_tools/#Extract_SubroutineMethod

related to #525 and #8

Could use Devel::Refactor to help with this

Attachments (1)

extract_subroutine.patch (2.0 KB) - added by rhebus 5 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 5 years ago by rhebus

  • Owner set to rhebus
  • Status changed from new to assigned

Changed 5 years ago by rhebus

comment:2 Changed 5 years ago by rhebus

I've attached a patch which provides rudimentary extract subroutine functionality. Problems remaining:

  • The new subroutine always goes to the end of the file. Is there a more sensible place to put it? (Answer: yes.)
  • There is no attempt to check for errors if Devel::Refactor::extract_subroutine fails. These errors can end as comments in code.

Having said that, when it works, it works great :)

comment:3 Changed 5 years ago by Sewi

Patch applied.

It should be changed to insert the new sub before the 1; if there is nothing than =pod.*=cut behind it.

rhebus, fix it, if you want, otherwise please close the ticket.

comment:4 Changed 5 years ago by rhebus

  • Resolution set to fixed
  • Status changed from assigned to closed

I'm submitting a new ticket for that, since I'm not sure how to achieve it yet.

comment:5 Changed 4 years ago by szabgab

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