sub load_tool { my $class = shift; my $wdg_plugin; #plugin's own widget eval { require $class . ".pm"; if ( "$class"->isa("Tk::Widget") ) { #If there is a UI then load as widget $wdg_plugin = $mw->$class( #we're sending references )->pack(); } }; #if any errors occurred, report them if ($@) { my $msg = "Initialization of tool $class failed:\n\n"; } }