[This seems to be a very useful module for those who try to minimize the 
memory usage, by finding out irrelevant modules loaded without your 
consent :)

Michael G Schwern said:

Module::Use appears to use the "let's sniff through %INC" approach,
which is clever and useful and sometimes more accurate, but requires
you actually run the program/module.

Module::Info uses the backend compiler.  It compiles the module but
doesn't not run it.  It finds all 'use' and 'require' statements using
the opcode tree.  As a result its perfectly accurate, except it can't
see things inside an eval().  Module::Use can.

The other nice thing Module::Info does (err, will do) is tell you one
what line and file module was used.  Useful for refactoring and
figuring out what uses what.
]

Michael G Schwern has then announced at [EMAIL PROTECTED]:

[I've fixed the message as Michael, has just released 0.09, the original 
announcement was for 0.08.]

This is the Egg Shen release [1] of Module::Info.
http://www.pobox.com/~schwern/src/Module-Info-0.09.tar.gz

This release adds modules_used().  Tells you all the modules and files
required or used by the module in question using the backend compiler.
As such its more reliable than a regex-based one.

        modules_used
              my @used = $module->modules_used;

            Returns a list of all modules and files which may be
            "use"'d or "require"'d by this module.

            NOTE These modules may be conditionally loaded, can't
            tell.  Also can't find modules which might be used
            inside an "eval".

I had to do some severe cargo-cultery from B::Deparse to make this
work.  If anyone's curious they can look at B::Module::Info, but I'd
recommend against it.

This method simply returns a list of all the modules used.  I plan on
providing another method which provides additional info such as where
each is used, how many times and if it was required as a bareword or
not (ie. "require Foo" vs "require 'Foo.pm'").  I've got all that
information internally, just need to put an interface on it.
That should make the refactoring folks happy.


0.08  Mon Dec 10 14:24:56 EST 2001
     * Implemented modules_used()
     - Fixed a little bug in walkoptree_filtered() and $B::Utils::file/line

0.07  Mon Dec 10 11:09:40 EST 2001
     * Implemented subroutines().  Need help getting modules_used() done.
     - Fixed up $B::Utils::file/line handling in B::Utils.
     - Fixed a little bug in is_core involving cannonical paths.
       I forget who gave me the patch!




-- 


_____________________________________________________________________
Stas Bekman             JAm_pH      --   Just Another mod_perl Hacker
http://stason.org/      mod_perl Guide   http://perl.apache.org/guide
mailto:[EMAIL PROTECTED]  http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/

Reply via email to