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

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
Always search PerlMonks. I did a brief search and found:

Tabulate sub defs, sub calls in Perl code by graff.

It'll work on a script, a module, modules, a directory, or directories. It uses B::Deparse, so I think that it meets your constraints. Here's the link for scan-source.perl.

A cool little tool that I use to analyse subs is Sub::Mutate. It can tell you if a sub is a method, function, XSUB, STANDALONE, etc. For example, I took the Dumper sub from Data::Dumper:

#!/usr/bin/perl use strict; use warnings; use Data::Dumper::Simple; use Sub::Mutate qw( sub_body_type sub_closure_role sub_is_lvalue sub_is_constant sub_is_method mutate_sub_is_method sub_is_debuggable mutate_sub_is_debuggable sub_prototype mutate_sub_prototype ); my $sub = \&Dumper; print my $type = sub_body_type($sub), "\n"; print $type = sub_closure_role($sub), "\n"; if ( sub_is_lvalue($sub) ) { print "sub is an lvalue\n"; } else { print "sub is not an lvalue\n"; } if ( sub_is_constant($sub)) { print "sub is a constant\n"; } else { print "sub is not a constant\n"; } if ( sub_is_method($sub)) { print "sub is a method\n"; } else { print "sub is not a method\n"; } if ( sub_is_debuggable($sub)) { print "sub is debuggable\n"; } else { print "sub is not debuggable\n"; } my $proto = sub_prototype($sub); print Dumper($proto); sub Dumper { return Data::Dumper->Dump([@_]); }

In reply to Re: Identify subs and their source by Khen1950fx
in thread Identify subs and their source by stmullins

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!
  • 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, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others chanting in the Monastery: (8)
    As of 2014-12-25 12:31 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      Is guessing a good strategy for surviving in the IT business?





      Results (160 votes), past polls