Re: How to get the Class name of an element
- From: Aristotle Pagaltzis <pagaltzis gmx de>
- To: gtk-perl-list gnome org
- Subject: Re: How to get the Class name of an element
- Date: Fri, 16 Apr 2010 20:06:26 +0200
* Pelle Nilsson <pellenilsson fastmail fm> [2010-04-16 13:00]:
If an object is used in a string context it will return
something like
Gtk2::Entry=HASH(0x12cfba8)
so you can use something like
if (substr($text, 0, 11) eq 'Gtk2::Entry') {
print "Entry!\n";
} elsif (substr($text, 0, 14) eq 'Gtk2::ComboBox') {
print "ComboBox!\n";
}
Wow, this is worthy of DailyWTF. I hope you have never actually
used this technique in any code.
Regards,
--
Aristotle Pagaltzis // <http://plasmasturm.org/>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]