# Load different modules depending on OS if($operating_system =~ /^MSWin/i) { if(!&require_if_present("Win32")) { $no_win32 = 1; } } # The $no_tk etc vars are set by command line # options before I get here if(!$no_tk) { if(&require_if_present("Tk")) { &require_if_present("Tk::DialogBox"); if($no_fileselect || !&require_if_present("Tk::FileSelect")) { $no_fileselect = 1; } if($no_progress || !&require_if_present("Tk::ProgressBar")) { $no_progress = 1; } if($no_dirtree || !&require_if_present("Tk::DirTree")) { $no_dirtree = 1; } } else { $no_tk = 1; } } # Then later I can... if($no_tk) { # Run without an interface ... } else { $main_win = new Tk::MainWindow( -title => "My App", ); ... }