++ed by:
Author image Eric Wilhelm
and 1 contributors


Devel::TraceDeps - track loaded modules and objects


  $ perl -MDevel::TraceDeps your_program.pl

And the real fun is to pull a tree of dependencies off of your test suite.

  $ perl -MDevel::eps=tree -S prove -l -r t
  $ ls tracedeps/

And of course no Devel:: module would be complete without an obligatory cute little shortcut which needlessly involves the DB backend:

  $ perl -d:eps whatever.pl

TODO: a cute little shortcut which needlessly claims an otherwise very funny-looking toplevel namespace.

  $ perl -MapDeps whatever.pl


Devel::TraceDeps delivers a comprehensive report of everything which was loaded into your perl process via the use, require, or do($file) mechanisms.

Unlike Devel::TraceLoad, this does not load any modules itself and is intended to be very unintrusive. Unlike Module::ScanDeps, it is designed to run alongside your test suite.

For access to the resultant data, see the API in Devel::TraceDeps::Scan.

In tree mode, forking processes and various other runtime effects *should* be supported but surprises abound in this realm -- tests and patches welcome.

TODO reports on shared objects loaded by DynaLoader/XSLoader.

TODO somehow catching the 'use foo 1.2' VERSION assertions. This is handled by use() and is therefore outside of our reach (without some tricks involving $SIG{__DIE__} or such.)

Possible Issues

I think these are going to be very pathological cases since I've already run a fair body of code through this without any visible hitches.

Version Number Ambiguity

If you try to require("5.whatever.pm"), it might fail.


If a required module expects to do something with caller() at BEGIN time (e.g. outside of import()), we have problems. If I could think of a good reason to rewrite the results of caller(), I would.


The tree setting goes all the way down into any perl subprocesses by setting ourselves in PERL5OPT. This is probably what you want if you're trying to package or bundle some code, but needs a knob if you're trying to do something else with it.

The PERL5OPT variable gets dropped if you use taint. Patches welcome!


Eric Wilhelm @ <ewilhelm at cpan dot org>



If you found this module on CPAN, please report any bugs or feature requests through the web interface at http://rt.cpan.org. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

If you pulled this development version from my /svn/, please contact me directly.


Copyright (C) 2008 Eric L. Wilhelm, All Rights Reserved.


Absolutely, positively NO WARRANTY, neither express or implied, is offered with this software. You use this software at your own risk. In case of loss, no person or entity owes you anything whatsoever. You have been warned.


This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.