local variable and event handler problem



Hello,

i've got a problem with a button connected signal.
local defined variables aren't available in the event called subroutine.
Calling it directly works fine, but clicking the button results in an "Use of 
uninitialized value in concatenation" error. ($image and $file are 
uninitialized)
How can i make the locally defined variables available for the event handler?

Rgds, Jens

        local $image = Gtk2::Image->new();
        local $file;
        my $bbutton = Gtk2::Button->new_from_stock ('gtk-go-forward');
        $bbutton->signal_connect (clicked => \&loadimage, 1); # doesn't work
        &loadimage(0); # this works fine

sub loadimage {
        ...
        $image->set_from_file($file);
}       





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