Re: Some questions about func_data things.



Christian Hamar said:
hi there.

So i create a thing like this :

$gh = "first";
$button = new Gtk2::Button("something");
$button->signal_connect('clicked' => \&do, $gh);

sub do {
      my ($tmp) = @_;
      print "tmp - $tmp\n";
}

So. I don't know. Is this the right way to "apply" a func_data thing to
signal_connect ? If this is the right way then my question:

When the script running then i got this:

tmp - HASH(0x34252525)    or something else hash value. How can i catch the
$gh value that i specified for func_data ???

A little example plz. many thx.

as a general rule when i'm connecting a signal or just dealing with any kind
of call back i always start out with a callback like this

use Data::Dumper;
sub callback
{
    print STDERR Dumper( @_ );
}

to see what all it gets me. of course the c doc's will tell you what to
expect, but most of the time doing the above will tell me all i need to know
about what the callback gets as params.

-rm



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