On Sat, 1 Oct 2005, Siegfried Heintze wrote: > How can I enumerate the file names of all the perl modules that are > loaded in the current perl program?
Probably not quite what you have in mind, but... $ cd /tmp $ for dir in `perl -le 'print join("\n", @INC)'`; do > find "$dir" | grep '\.pm'; done | wc -l > done | wc -l That'll count all the pm module files in @INC, which is sort of what you're asking for, but not quite, I guess. Grepping those trees for package declarations would probably be a little more accurate: $ cd /tmp $ for dir in `perl -le 'print join("\n", @INC)'`; do > grep -rl '^ *package.*;' "$dir" > done | wc -l But that's crude & could end up massively overcounting modules... :-/ Why do you need to know how many files comprise the Perl modules that your current program depends on? Are you hitting a system controlled process open file limit or something? If you really want to do this the way I take it you do, you need to take all your 'use Foo' statements, figure out where in @INC Foo gets defined from (it could come up more than once, so you need to find the version that's actually used), and then sort through what you find. It seems like a lot of work, and, short of figuring out version issues, I have a hard time seeing why doing this would be useful. In any case, the old, standard reply is relevant here; What have you tried so far? What code have you written? Show us what you've done and we can help you more. -- Chris Devers ýNîà¢øP)
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>