> Is it possible to populate "my %Preload" hash with Tcl::Tk as 
> a special case??

That won't help, because listing Foo.pm in %Preload doesn't prevent
Foo.pm from being scanned, it only adds to the list of stuff to scan.

> this is probably FAQ item, but why not tracking all these "require"
> strings instead?

Module::ScanDeps does, but in an ad-hoc way - see the the large pile
of regexes in sub scan_chunk. As an aside: I once tried to use PPI,
but it is at least an order of magnitude slower than Module::ScanDeps
- and the only thing I tried to extract from the DOM tree that PPI
builds
was use/require statements. 

Anyway, can you try the following patch. It zaps all literal strings
(at least the ones delimited by single or double quotes) just before
the final round of regexes in scan_chunk (that should have no need
to look into strings). 

$ diff -ub lib/Module/ScanDeps.pm{.orig,}
--- lib/Module/ScanDeps.pm.orig 2006-07-24 10:19:02.531250000 +0200
+++ lib/Module/ScanDeps.pm      2006-07-24 10:20:50.812500000 +0200
@@ -622,6 +622,8 @@
         }
         return $1 if /(?:^|\s)(?:do|require)\s+[^"]*"(.*?)"/;
         return $1 if /(?:^|\s)(?:do|require)\s+[^']*'(.*?)'/;
+        s/"(?:\\.|[^"])*"//g;
+        s/'(?:\\.|[^'])*'//g;
         return $1 if /[^\$]\b([\w:]+)->\w/ and $1 ne 'Tk';
         return $1 if /\b(\w[\w:]*)::\w+\(/;

This fixes the output of 
   scandeps.pl -e "use Tcl::Tk;"
for me (on Windows, using ActiveState perl).

Cheers, Roderich

Reply via email to