Meine (etwas groesseren) Tk-Programme haben meist die folgenden Module:
1. MyApp::Widgets: enthaelt Wrapper-Code zu den einzelnen Widgets, die schon Standardoptionen enthalten, z.B.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
sub Button {
my( $parent, $text, $command, %options ) = @_;
ref $text
? $options{-textvariable} = $text
: $options{-text} = $text;
ref $command
? $options{-command} = $command
: $options{-background} = '#ff0000';
return $parent->Button(
-background => '#ffdd00',
-font => $MyApp::Config::DefaultFont,
...
%options,
);
}
2. MyApp::Config: hier steht die ganze Konfiguration oder dieses Modul dient als Interface zur Konfiguration
3. MyApp::GUI: hier ist der ganze GUI-Code drinnen
4. MyApp::Callbacks: hier steht der code drinnen, der z.B. auf click auf button.
Dann noch eventuell weitere, die Schnittstellen zu anderen Systemen enthalten, z.B. MyApp::LDAP, MyAPP::DBI usw...
und ein kleines Hauptprogramm