Hi,
I'm trying to pack a script that's using Tk. It simply uses

use Tk;

and nothing else, all other Tk modules are autoloaded from Tk::Widget.
If a pack this script using pp, several needed Tk modules go unnoticed
and I have to add lotsa

use Tk::Foo;

as a workaround. The problem seemd to be Module::ScanDeps which
doesn't detect all Tk modules used. Here're my questions:

- What's the purpose of this line for %Preload

    'Tk.pm'                         => [qw( Tk/FileSelect.pm )],

- I got considerable more mileage (i.e. more Tk modules detected) 
  by adding the following line to scan_chunk:

        return $1 if /[^\$]\b([\w:]+)->\w/ and $1 ne 'Tk';
        return $1 if /([\w:]+)::\w/ and $1 ne 'Tk' and $1 ne 'PAR';
+       return "Tk::$1" if /->([A-Z]\w+)\b/;

  This detects the common Tk programming idiom:
  if I already have a widget $w, create a new Tk::Fubar widget as
  a child of $w with

      $w->Fubar(...);

  TK::Widget::AUTOLOAD explicitly checks for an autoloded Method
  matching /::([A-Z]\w+)$/ and will require Tk::$1 in this case.
  
  The line in scan_chunk should probably only trigger if ScanDeps
  has already encountered Tk.pm or any Tk/*.pm.

Cheers, Roderich



Reply via email to