http://qs321.pair.com?node_id=452362


in reply to Re: Is there a module which Perl has to load when using any module?
in thread Is there a module which Perl has to load when using any module?

Actually, it's much simpler than that:
END { print STDERR "Modules used:\n", map { " $_\n" } values %INC; }

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.

  • Comment on Re^2: Is there a module which Perl has to load when using any module?
  • Download Code

Replies are listed 'Best First'.
Re^3: Is there a module which Perl has to load when using any module?
by blazar (Canon) on Apr 28, 2005 at 16:09 UTC
    Indeed. Of course the original discussion was about how to monitor module loading on a "per use statement basis", as can be suggested by the minimal example supplied - still sloppily speaking here, but I guess it's easy to understand what I really mean here.

    But then again it was just an example of how to use a coderef in @INC to achieve something similar to what the OP wanted...

Re^3: Is there a module which Perl has to load when using any module?
by DaWolf (Curate) on Apr 28, 2005 at 21:08 UTC
Re^3: Is there a module which Perl has to load when using any module?
by djp (Hermit) on Apr 29, 2005 at 01:09 UTC
    Brilliant. Can I suggest sorting for readability:
    END { print STDERR "Modules used:\n", map { " $_\n" } sort values %INC; }