package LDFM::MainController; use utf8; use warnings; use strict; use base 'Gtk2::GladeXML::Simple'; our $VERSION = '0.01'; sub new { my ($class,%params)=@_; my $glade_file=dir($params{glade_dir})->file('ldfm-dialog.glade'); my $self=$class->SUPER::new($glade_file); $self->{domanda}->set_text($params{domanda}); $self->{risposta}->set_text($params{risposta}||''); return $self; } sub run { my ($self)=@_; $self->{dialog}->set_default_response('ok'); my $response=$self->{dialog}->run(); if ($response eq 'ok') { my $data=$self->{risposta}->get_text(); $self->{dialog}->destroy(); return $data; } else { return; } } 1;