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 =)


In reply to Re: Re: Re: wishlist: static analysis of perl modules by zengargoyle
in thread wishlist: static analysis of perl modules by dash2

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.