Reputation: 19027
I've got a big collection of utility subroutines stuck in a single giant myUtil.pm
Perl module. I'm trying to get a profile of how the pile of subroutines depend on each other.
I found Module::ScanDeps, which looks for dependencies across modules. Is there a similar tool which looks at dependencies within a module?
I'd prefer to have a static analysis, as I'm not very confident that I've got enough test cases to cover all of the code paths.
Upvotes: 3
Views: 148
Reputation: 98398
There's probably something newer (and PPI-based), but the older B::Xref does this.
Foo.pm:
package Foo;
use 5.014;
use warnings;
sub foo { bar() }
sub bar { $_[0]-- and bar() }
sub baz { foo(); bar () }
1;
perl -MO=Xref -e'use Foo'
:
...
File Foo.pm
Subroutine (definitions)
Package Foo
&bar s4
&baz s6
&foo s4
Subroutine Foo::bar
Package Foo
&bar &5
Subroutine Foo::baz
Package Foo
&bar &6
&foo &6
Subroutine Foo::foo
Package Foo
&bar &4
Upvotes: 3