Re: How to get the Class name of an element



* 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]