How to pass value back to main via object



I am just learning about OO perl and trying to grasp how to tie it in
with Gtk2.  The question I have is how can I pass a value back to the
main loop after the loop has already been invoked.

Example:

#!/usr/perl/bin

my $self = Main->new->mainLoop; #Create a new object and start the loop
$self->{'window'}->set_default_size (700,450); # How can I make the
loop obey this command?


package Main;

use strict;
use Gtk2 -init;
use Gtk2::SimpleList;

sub new {
    my $class = shift;
    my $self = { };
    bless $self, $class;
    return $self;
}

sub mainLoop {
    my $self = shift;
    $self->{'window'} = Gtk2::Window->new;
    $self->{'window'}->signal_connect (delete_event => sub {Gtk2->main_quit});
    $self->{'window'}->set_title ('Object Browser');
    $self->{'window'}->show_all;
    Gtk2->main;
}


Thank you for your time,

Tyler Hepworth



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]