Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^4: Features missing in perl IDEs?

by BUU (Prior)
on Jun 17, 2005 at 23:08 UTC ( #467897=note: print w/replies, xml ) Need Help??


in reply to Re^3: Features missing in perl IDEs?
in thread Features missing in perl IDEs?

Wow. An elightening explanation. One more question though. You say when you're extracting methods for the perl code, "Figure out what local vars it needs and pass them as arguments". Why don't you have to do this for the java code?

As I was writing this, it occurred to me that you don't have to do it because the java one scans your selection for variables and automatically determines which variables you need passed. In which case, I really think that's fairly doable in the perlworld, especially now that we have PPI.

I have to admit, the entire point of this thread was so I could think of something cool to do with PPI, as I think it's a really incredible module.. I just couldn't think of anything useful to do with it!

As an example, if you had this as your code selection:
my $x = frob( $bz ); print $x + $z; foobar( $x );
Using the power of PPI it should be trivial to generate a new method:
sub methodname { my ($bz, $z ) = @_; my $x = frob($bz; print $x + $z; foobar( $x ); }
Is that more or less what you had in mind?

Replies are listed 'Best First'.
Re^5: Features missing in perl IDEs?
by adrianh (Chancellor) on Jun 19, 2005 at 01:42 UTC
    As I was writing this, it occurred to me that you don't have to do it because the java one scans your selection for variables and automatically determines which variables you need passed.

    Yup.

    Using the power of PPI it should be trivial to generate a new method ... Is that more or less what you had in mind?

    Yup. With the addition of the original selection being replaced by a call to the new method. extract_subroutine() from Devel::Refactor does a fair job of this particular task already.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://467897]
help
Chatterbox?
[Discipulus]: but if have case like subname(15,undef,3 ) maybe bettere named parameters
[Lady_Aleena]: I don't want to have to do: alpha_menu($hash, undef, $type);
[Lady_Aleena]: Or what Discipulus said.
[shmem]: Lady_Aleena: geany supports ctags.
[Discipulus]: a good compromise can be my ($need, $opts_ref) = @_ a scalar and an hash reference
[Discipulus]: see you monks!
[Lady_Aleena]: shmem, let me get this sub rewritten, then I will look into how to use ctags in geany. Deal? 8)
[shmem]: Discipulus: yeah, that might eventually prepare the path for OO ;-)
[Lady_Aleena]: See you, Discipulus.
[shmem]: Lady_Aleena: that's up to you. I only wanted to show you a path that might be more comforting than command line grep ;-)

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (8)
As of 2017-04-27 12:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (506 votes). Check out past polls.