I want to load a module if it is there or set a flag to turn of (or
modify) code that uses the module if it is not there.  Example:

BEGIN FILE
#!/usr/bin/perl

my $gtk = eval "use Gtk ; return 1";

if ($gtk) {
    Gtk->init;

    my $window = new Gtk::Window;
    $window->add(new Gtk::Label("Hello World!"));
    $window->signal_connect( destroy => sub { Gtk->main_quit } );
    $window->show_all;
    Gtk->main;
} else {
    print "Hello World!\n";
}
END FILE

This seems to work.  On my linux box I get a window and on the Sun box I
get "Hello World!" on the prompt.  Is this the best way (I know
TMTOWTDI) to acheive my goal?  Is this dangerous in any way? 

-- 
Today is Boomtime, the 6th day of Confusion in the YOLD 3167
P'tang!


Reply via email to