Re: How do I retrieve the 'type' of an object
- From: Ross McFarland <rwmcfa1 neces com>
- To: Daniel Kasak <dkasak nusconsulting com au>
- Cc: gtk-perl list <gtk-perl-list gnome org>
- Subject: Re: How do I retrieve the 'type' of an object
- Date: Sun, 06 Jun 2004 18:56:35 -0400
On Sun, 2004-06-06 at 18:32, Daniel Kasak wrote:
I'm looping through a set of objects, and I want to get the type of
object, ( eg GtkEntry ) and then decide what to do based on the type.
How do I do that?
eg:
foreach my $field (@{$self->{fieldlist}}) {
my $widget = $self->{form}->get_widget($field);
# Need to figure out what type of object $widget is
}
the perl ref function/operator should do the trick:
my $button = Gtk2::Button->new ('Click _Me');
print '$button's type is: '.(ref $button)."\n";
--
-rm
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]