Problems? Is your data what you think it is? | |
PerlMonks |
Re: using 'use' conditionallyby dash2 (Hermit) |
on Nov 06, 2002 at 17:31 UTC ( [id://210812]=note: print w/replies, xml ) | Need Help?? |
Lots of people have pointed out BEGIN, "use if" and "require".
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:
The two MyInterface subclasses provide different ways of doing the same thing... so then you can write:
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~
In Section
Seekers of Perl Wisdom
|
|