package Widget2; Construct Tk::Widget 'Widget2'; use Tk; use Tk::Frame; # go ahead and create elements in the widget, like it would be a # standalone app (don't forget to add the close button :D #### 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"; } }