#!/usr/bin/perl use strict; use warnings; use Gtk2 -init; use Glib qw/TRUE FALSE/; my $window = Gtk2::Window->new('toplevel'); $window->signal_connect(destroy => sub {Gtk2->main_quit;}); #<---ERROR ### $window->show_all; my $msg_dialog = Gtk2::MessageDialog->new_with_markup($window, 'modal', 'error', 'yes-no', "Would you like to retry the connection?"); $msg_dialog->set_title("No Connection Found"); $msg_dialog->set_destroy_with_parent(TRUE); $msg_dialog->signal_connect (response => sub { my ($self, $response) = @_; if ($response eq 'yes') { $msg_dialog->hide(); my_function("yes"); } elsif ($response eq 'no') { $msg_dialog->destroy(); $window->destroy; } }); $msg_dialog->run(); Gtk2->main; 0;