in reply to using 'use' conditionally
if ($ARGV[0] =~ /-g/) { # do gui die "You need Tk." unless (eval("require Tk;")); #use Tk; require Tk; Tk->import; $mw = MainWindow->new; $mw->Button(-text=>"EXIT", -command=>sub{exit})->pack(-side=>"bottom", -fill=>"both"); MainLoop; print "gui done.\n"; } else { # do non-gui print "non-gui stuff\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(tye)Re2: using 'use' conditionally
by tye (Sage) on Dec 03, 2002 at 17:30 UTC |