On Fri, 2002-08-09 at 04:37, RAHUL SHARMA wrote:
> Hi All,
>
> I want to "use" a module whose filename is into some variable.
>
> For e.g.
>
> use $filename; # $filename contains the modulename that is to be imported.
>
> I'm getting an error.
>
> Please help.
Try something like:
<code>
#!/usr/bin/perl -w
use strict;
my $gtk = 'Gtk';
my $gtk_loaded = eval "use $gtk; 1";
if ($gtk_loaded) {
Gtk->init;
my $window = Gtk::Window->new;
$window->signal_connect('destroy', sub { Gtk->main_quit });
$window->add(Gtk::Label->new("Hello World"));
$window->show_all;
Gtk->main;
} else {
print "Hello World\n";
}
</code>
--
Today is Sweetmorn the 2nd day of Bureaucracy in the YOLD 3168
Wibble.
Missile Address: 33:48:3.521N 84:23:34.786W
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]