if you're rather consistant in your coding style (or maybe after a run through perltidy) and you're familiar with the way the code is constructed then it seems you could do some of what you want with simple text processing.
just grep for /sub/ and build a list of your named subroutines, then grep for the subroutine names on lines that don't match /sub/.
i've been planning to look at perltidy's source for ideas along the same lines as your question. i figure if perltidy can grok perl enough to colorize and format perl nicely then it might be easy enough to make it do other transformations on the code. i'd like to be able to do something like:
package F;
my %D = ( foo => 1 );
sub new { my ($c,%p) = @_; my %s = ( %D, %p ); return bless \%s, $c; }
sub f_1 { my $s = shift; ... }
package main;
my $f = new F;
print $f->f_1('blah');
and then be able to generate a transform file.
F -> Foo
%D -> Default
&new
$c -> class
%p -> parameter
%s -> self
&f_1 -> marble
$s -> self
main
$f -> foo_obj
and then be able to swap back and forth. most of the stuff i need to get done deals with tight name domains, and by that i mean that:
j is a jack
h is a host
ac is an account
t is a topology
p is a port
v is a vlan
n is a netmask
b is a building
r is a room
m is a MAC address
it doesn't confuse me at all, might be because i started BASIC back in the early Apple II days when you could only use single character variables, and the days of Fortran where the initial character represented int/float, or maybe because i was a physic major and they'll go into foreign characters before they'll use longer varibles.
but i realize that for the people who look at my code when i'm done just see noise unless the variables are longer.
once the code is actually written i don't have a problem with the names being long, i just haven't found a better way as of yet than manually (vim, so it isn't that hard =) |