in reply to using 'use' conditionally
Another point is that (unless your program is very simple) you probably don't want to include the Tk interface and the command line interface in the same packages.
Instead do something like this:
my $iface = $opt_g ? new MyInterface::Tk : new MyInterface::CommandLin +e;
The two MyInterface subclasses provide different ways of doing the same thing... so then you can write:
$iface->notify("Your flies are down"); $iface->ask("Do you want to zip them up?", 'Y', 'N');
This separates your interface code nice and cleanly from the rest of your program.
Of course, you still have to be careful what you require, because if Tk isn't installed, then MyInterface::Tk will presumably die on compilation.
dave hj~
|
|---|