wenD has asked for the wisdom of the Perl Monks concerning the following question:

There is probably some perl -option script_name thing I can run to have the script printed back to me with all of the referenced subroutines included in one single piece of code text... right?

Sometimes I'd like to be able to see all of the code at once vs. having to look within Perl module files and track down each individual subroutine chunk.

Replies are listed 'Best First'.
Re: Show me the subroutines?
by davidrw (Prior) on Jul 01, 2005 at 13:08 UTC
    But you want a list of sub's that your script actually executes, you could use Devel::Cover -- it will generate a nice html output of the subs run and how much time was spent in there and what lines w/in the sub were run.

    (of possible interest: There was a recent node about listing the sub's in a module but my searches are failing...Update: Found it: Getting a list of sub routines)
    Update: moved my 'recent node' sentence to end since not primary focus
        nope, though that on'e sinteresting too.. I found it -- it was this one: Getting a list of sub routines (the space in 'sub routine' threw me off -- i had searched on 'list subs' and 'list subroutine')
Re: Show me the subroutines?
by anonymized user 468275 (Curate) on Jul 01, 2005 at 13:15 UTC
    If you are trying to do the same as the -x option for the shell, installing Devel::Trace enables you to do

    perl -d:Trace script

    One world, one people

Re: Show me the subroutines?
by Fletch (Bishop) on Jul 01, 2005 at 13:15 UTC

    Not exactly the source for everything, but you might also check out B::Xref. That'll give you chapter and verse (or at least file and line number) of what is referenced where.

    --
    We're looking for people in ATL

Re: Show me the subroutines?
by tphyahoo (Vicar) on Jul 01, 2005 at 14:25 UTC
    If this is related to familiarizing yourself with new, possibly messy code, possibly preparing yourself for a refactor, you may want to have a look at grepping out global vars?.
Re: Show me the subroutines?
by graff (Chancellor) on Jul 01, 2005 at 20:24 UTC