S
Sherm Pendley
Ted said:I've inherited a perl program and libs which have extremely
nested series of "require" statements. ....
Is there any way to --->count the lines of perl src<---
by inserting some sort of magic statement right after
the "main()" line in the master file, "foo.pl"?
You can get a list of all the files that have been included with use(),
require(), or do() from the special hash %INC. The keys are the values as
given in your script(s), and the values are the actual paths at which the
files were found.
So, in the simplest case, it could be as simple as this:
system("wc -l " . join(' ', values(%INC)));
Like I said, that's the simple case - obviously, if there are spaces or
other funky stuff in the paths to these files, you'll need to deal with
that by escaping them properly before executing the "wc -l" shell command.
I'll leave that as an exercise for the reader.
sherm--