At 6:09 PM on 27 May 2010, William Bulley wrote:

> According to Hendrik Schumacher <h...@activeframe.de> on Thu, 05/27/10
> at 17:05:
> > 
> > A crude solution would be to print the contents of %INC somewhere
> > in your application:
> > 
> > perl -e 'use DBI; use Time::Local; print join ("\n", keys %INC);'
> 
> Good suggestion, but won't that list a whole bunch of other stuff
> that is not being used, but that exists in the INC "tree" somewhere?

Actually, no.  %INC only lists modules that have been loaded into the
current instance, "via the 'do', 'require', or 'use' operators."[1]  

The only extraneous stuff it includes is the pragmas (strict, features,
warnings, etc.) but those are easily excluded because of their
all-lowercase names.

Now that Hendrik mentioned it, it seems to me that %INC is probably your
best bet.  But what you would have to be sure of, in the script that
loads your module to dump %INC, is that you also run your module through
its paces to be sure that all dependencies are loaded--even if some are
"require"d instead of "use"d--before you dump %INC.


[1] see the %INC entry in perlvar.

-- 

C. Chad Wallace, B.Sc.
The Lodging Company
http://www.lodgingcompany.com/
OpenPGP Public Key ID: 0x262208A0

Attachment: signature.asc
Description: PGP signature

Reply via email to