Ticket #531 (closed enhancement: fixed)

Opened 5 years ago

Last modified 3 years ago

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:


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

related to #525 and #8

Could use Devel::Refactor to help with this


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

Change History

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

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

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

comment:5 Changed 3 years ago by szabgab

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