matisse wrote on Sun Jan 30 18:10:36 CET 2005:
I've been talking in email with the author of Devel::Refactor, Scott Sotka, and I am trying to add a "rename_subroutine" feature that could be made avaiable in EPIC. This raises some questions: 1. How would you feel about my changing Devel::Refactor so that the current "extract subroutine" was provided by a new object method: my $refactory = Devel::Refactor->new; my ($new_sub_call,$new_code) = $refactory->extract_subroutine($new_name,$code_snippet); 2. What would be the best interface to rename_subroutine() for EPIC? I think we want to be able to pass either a single file name, or a directory to search all Perl files. I think it would be nice if EPIC showing a comparison for each file, showing the proposed changes, like a diff, so the user can accept or reject each propsoed change.
leo_forge wrote on Fri Feb 4 09:15:24 CET 2005:
Don't know if Jochen has already replied to your questions -cause this issue is his business. Either you code it by yourself - prefered way. There you can make your own proposals and see what the result will be. Otherwise if there is no response, open a RFE and then let's see what the outcome will be.
matisse wrote on Fri Feb 4 17:11:46 CET 2005:
I have started coding it, but since I do not know how eclipse and EPIC work insternally I wanted to ask to make sure that I don't make it too hard to integrate. What I am doing is creating a method that takes either a file name or a directory, and returns a list of file-name/line-number pairs for each time the old subroutine name is found. I might provide a second method that actually does the replacement, taking a list of file-name/line-number pairs and replacing /old/new/ only on those line numbers.
matisse wrote on Sat Feb 5 21:59:10 CET 2005:
I am now thinking of two alternatives for what rename_subroutine should return. Option 1 is a data structure that has just the lines that change. Option 2 is a data structure that contains the entire changed file(s) My hope is that the result in EPIC would be to show the user a file comparison, and allow the user to pick which changes to make to the file in the workspace. Option 1 would return a hashref of arrays of hashes like this: { ./path/to/file1.pl => [ { 11 => "if (myClass->newName($x)) {\n" }, { 27 => "my $result = myClass->newName($foo);\n"}, ], ./path/to/file2.pm => [ { 235 => "sub newName {\n"}, ], } In Option 2, the values of the hashref would be the entire text of the changed file(s)
matisse wrote on Mon Feb 7 03:55:13 CET 2005:
I finished a first version of the changes, using basically Option1 as described above. I've sent a tarfile to Scott (the author of Devel::Refactor) and to Jochen. If anyone wants a copy (this is alpha software!) let me know and I'll send you a copy.
leo_forge wrote on Mon Feb 7 10:44:10 CET 2005:
I'm curious, please send me also a copy.
Note: The above is an archived snapshot of a forum thread. Use the original thread at sf.net to post comments.