Here's how I do it with my applications. Create a subroutine
exitApp and use
OnDestroy with the first MainWindow to call it when somebody destroys (closes) that main widget. That is the definition of the program closing.
my $mw = new MainWindow();
$mw->OnDestroy( \&exitApp );
- - arden.