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

Let’s say that, among all of the modules listed in an autobundle, I want to know which ones directly or indirectly depend upon $module_name =~ /APR/i.

In other words, “if you see insert unwanted module-name here being dragged-in to your installation, here are the modules that are causing it.”

Is there a Heh... Where is the module or command that will find this out for me?

Replies are listed 'Best First'.
Re: The question is, for example: "What drags in APR?"
by Corion (Patriarch) on Jun 16, 2011 at 13:59 UTC

    See require about the hooks, and caller about who called you(r) hook.

    BEGIN { unshift @INC, sub { my ($self, $file) = @_; if ($file =~ /\bAPR.pm$/) { print "$file was loaded via " . caller(1); }; }; };
Re: The question is, for example: "What drags in APR?"
by locked_user sundialsvc4 (Abbot) on Jun 16, 2011 at 20:55 UTC

    I wound up giving up (fairly quickly ...) on the autobundle approach, because it appeared to be doomed to causing me to install whatever was there, as opposed to whatever was (still) needed.   (It’s rather amazing how much “cruft” winds up in a PERL5LIB over time ... almost as bad as a typical Linux distribution.)

    Over in this thread, http://www.perlmonks.org/?node_id=909966, I took a different approach to the problem.   I decided to try to find out what the installed code actually used and to automagically install that.   I even came up with (and contributed ...) a somewhat cleverly lazy (if I may say so myself) utility.